You are here

protected function RouteEntity::resolveEntity in GraphQL 8.3

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to resolve.

\Drupal\Core\Url $url: The url of the entity to resolve.

array $args: The field arguments array.

\GraphQL\Type\Definition\ResolveInfo $info: The resolve info object.

Return value

\Generator

2 calls to RouteEntity::resolveEntity()
RouteEntity::resolveEntityTranslation in modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/RouteEntity.php
Resolves the entity translation from the given url context.
RouteEntity::resolveValues in modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/RouteEntity.php
Retrieve the list of field values.

File

modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/RouteEntity.php, line 137

Class

RouteEntity
Retrieve the current routes entity, if it is an entity route.

Namespace

Drupal\graphql_core\Plugin\GraphQL\Fields\Routing

Code

protected function resolveEntity(EntityInterface $entity, Url $url, array $args, ResolveInfo $info) {
  $access = $entity
    ->access('view', NULL, TRUE);
  if ($access
    ->isAllowed()) {
    (yield $entity
      ->addCacheableDependency($access));
  }
  else {
    (yield new CacheableValue(NULL, [
      $access,
    ]));
  }
}