You are here

protected function EntityQuery::getQuery in GraphQL 8.3

Create the full entity query for the plugin's entity type.

Parameters

mixed $value: The parent entity type.

array $args: The field arguments array.

\Drupal\graphql\GraphQL\Execution\ResolveContext $context: The resolve context.

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

Return value

\Drupal\Core\Entity\Query\QueryInterface|null The entity query object.

1 call to EntityQuery::getQuery()
EntityQuery::resolveValues in modules/graphql_core/src/Plugin/GraphQL/Fields/EntityQuery/EntityQuery.php
Retrieve the list of field values.

File

modules/graphql_core/src/Plugin/GraphQL/Fields/EntityQuery/EntityQuery.php, line 148

Class

EntityQuery
@GraphQLField( id = "entity_query", secure = false, type = "EntityQueryResult", arguments = { "filter" = "EntityQueryFilterInput", "sort" = "[EntityQuerySortInput]", "offset" =…

Namespace

Drupal\graphql_core\Plugin\GraphQL\Fields\EntityQuery

Code

protected function getQuery($value, array $args, ResolveContext $context, ResolveInfo $info) {
  if (!($query = $this
    ->getBaseQuery($value, $args, $context, $info))) {
    return NULL;
  }
  $query
    ->range($args['offset'], $args['limit']);
  if (array_key_exists('revisions', $args)) {
    $query = $this
      ->applyRevisionsMode($query, $args['revisions']);
  }
  if (array_key_exists('filter', $args)) {
    $query = $this
      ->applyFilter($query, $args['filter']);
  }
  if (array_key_exists('sort', $args)) {
    $query = $this
      ->applySort($query, $args['sort']);
  }
  return $query;
}