Files
animethemes-server/app/GraphQL/Definition/Relations/HasManyRelation.php
T

39 lines
679 B
PHP

<?php
declare(strict_types=1);
namespace App\GraphQL\Definition\Relations;
use App\Enums\GraphQL\RelationType;
use GraphQL\Type\Definition\Type;
/**
* Class HasManyRelation.
*/
class HasManyRelation extends Relation
{
/**
* The type returned by the field.
*
* @return Type
*/
protected function type(): Type
{
if (!$this->nullable) {
return Type::nonNull(Type::listOf($this->type));
}
return Type::listOf($this->type);
}
/**
* The Relation type.
*
* @return RelationType
*/
protected function relation(): RelationType
{
return RelationType::HAS_MANY;
}
}