You are here

public function EntityOwner::resolve in GraphQL 8.4

Resolver.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

Return value

\Drupal\user\UserInterface|null

File

src/Plugin/GraphQL/DataProducer/Entity/EntityOwner.php, line 36

Class

EntityOwner
Returns the user that owns the entity.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\Entity

Code

public function resolve(EntityInterface $entity) {
  if ($entity instanceof EntityOwnerInterface) {
    return $entity
      ->getOwner();
  }
  return NULL;
}