You are here

protected function EntityResource::getCollectionCountQuery in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getCollectionCountQuery()

Gets a basic query for a collection count.

Parameters

\Drupal\jsonapi\ResourceType\ResourceType $resource_type: The base JSON:API resource type for the query.

array $params: The parameters for the query.

\Drupal\Core\Cache\CacheableMetadata $query_cacheability: Collects cacheability for the query.

Return value

\Drupal\Core\Entity\Query\QueryInterface A new query.

1 call to EntityResource::getCollectionCountQuery()
EntityResource::getCollection in core/modules/jsonapi/src/Controller/EntityResource.php
Gets the collection of entities.

File

core/modules/jsonapi/src/Controller/EntityResource.php, line 922

Class

EntityResource
Process all entity requests.

Namespace

Drupal\jsonapi\Controller

Code

protected function getCollectionCountQuery(ResourceType $resource_type, array $params, CacheableMetadata $query_cacheability) {

  // Reset the range to get all the available results.
  return $this
    ->getCollectionQuery($resource_type, $params, $query_cacheability)
    ->range()
    ->count();
}