EntityOwner.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Fields/Entity/EntityOwner.php
View source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Fields\Entity;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use Drupal\user\EntityOwnerInterface;
use GraphQL\Type\Definition\ResolveInfo;
class EntityOwner extends FieldPluginBase {
protected function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if ($value instanceof EntityOwnerInterface) {
(yield $value
->getOwner());
}
}
}
Classes
Name |
Description |
EntityOwner |
Plugin annotation
@GraphQLField(
id = "entity_owner",
secure = true,
name = "entityOwner",
type = "entity:user",
parents = {"EntityOwnable"}
) |