protected function EntityQuery::applySort in GraphQL 8.3
Apply the specified sort directives to the query.
Parameters
\Drupal\Core\Entity\Query\QueryInterface $query: The entity query object.
mixed $sort: The sort definitions from the field arguments.
Return value
\Drupal\Core\Entity\Query\QueryInterface The entity query object.
1 call to EntityQuery::applySort()
- EntityQuery::getQuery in modules/
graphql_core/ src/ Plugin/ GraphQL/ Fields/ EntityQuery/ EntityQuery.php - Create the full entity query for the plugin's entity type.
File
- modules/
graphql_core/ src/ Plugin/ GraphQL/ Fields/ EntityQuery/ EntityQuery.php, line 258
Class
- EntityQuery
- @GraphQLField( id = "entity_query", secure = false, type = "EntityQueryResult", arguments = { "filter" = "EntityQueryFilterInput", "sort" = "[EntityQuerySortInput]", "offset" =…
Namespace
Drupal\graphql_core\Plugin\GraphQL\Fields\EntityQueryCode
protected function applySort(QueryInterface $query, $sort) {
if (!empty($sort) && is_array($sort)) {
foreach ($sort as $item) {
$direction = !empty($item['direction']) ? $item['direction'] : 'DESC';
$language = !empty($item['language']) ? $item['language'] : null;
$query
->sort($item['field'], $direction, $language);
}
}
return $query;
}