You are here

protected function EntityResource::getCollectionCountQuery in JSON:API 8

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

Gets a basic query for a collection count.

Parameters

string $entity_type_id: The entity type for the entity 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.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

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

File

src/Controller/EntityResource.php, line 876

Class

EntityResource
Process all entity requests.

Namespace

Drupal\jsonapi\Controller

Code

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

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