mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-10-24 11:39:21 +02:00
39 lines
648 B
PHP
39 lines
648 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Definition\Relations;
|
|
|
|
use App\Enums\GraphQL\RelationType;
|
|
use GraphQL\Type\Definition\Type;
|
|
|
|
/**
|
|
* Class HasOneRelation.
|
|
*/
|
|
class HasOneRelation extends Relation
|
|
{
|
|
/**
|
|
* The type returned by the field.
|
|
*
|
|
* @return Type
|
|
*/
|
|
protected function type(): Type
|
|
{
|
|
if (!$this->nullable) {
|
|
return Type::nonNull($this->type);
|
|
}
|
|
|
|
return $this->type;
|
|
}
|
|
|
|
/**
|
|
* The Relation type.
|
|
*
|
|
* @return RelationType
|
|
*/
|
|
protected function relation(): RelationType
|
|
{
|
|
return RelationType::HAS_ONE;
|
|
}
|
|
}
|