function EntityResource::getCollectionCountQuery

Same name in other branches
  1. 9 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getCollectionCountQuery()
  2. 8.9.x core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getCollectionCountQuery()
  3. 11.x 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 945

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.