You are here

public function EntityId::resolve in GraphQL 8.4

Resolver.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

Return value

int|string|null

File

src/Plugin/GraphQL/DataProducer/Entity/EntityId.php, line 34

Class

EntityId
Returns the ID of an entity.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\Entity

Code

public function resolve(EntityInterface $entity) {
  return $entity
    ->id();
}