You are here

protected function DataProviderEntity::getQueryCount in RESTful 7.2

Prepare a query for RestfulEntityBase::count().

Return value

\EntityFieldQuery The EntityFieldQuery object.

3 calls to DataProviderEntity::getQueryCount()
DataProviderComment::getQueryCount in modules/restful_example/src/Plugin/resource/comment/DataProviderComment.php
Overrides DataProviderEntity::getQueryCount().
DataProviderEntity::count in src/Plugin/resource/DataProvider/DataProviderEntity.php
Counts the total results for the index call.
DataProviderNode::getQueryCount in src/Plugin/resource/DataProvider/DataProviderNode.php
Overrides DataProviderEntity::getQueryCount().
2 methods override DataProviderEntity::getQueryCount()
DataProviderComment::getQueryCount in modules/restful_example/src/Plugin/resource/comment/DataProviderComment.php
Overrides DataProviderEntity::getQueryCount().
DataProviderNode::getQueryCount in src/Plugin/resource/DataProvider/DataProviderNode.php
Overrides DataProviderEntity::getQueryCount().

File

src/Plugin/resource/DataProvider/DataProviderEntity.php, line 548
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderEntity.

Class

DataProviderEntity
Class DataProviderEntity.

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

protected function getQueryCount() {
  $query = $this
    ->getEntityFieldQuery();

  // If we are trying to filter on a computed field, just ignore it and log an
  // exception.
  try {
    $this
      ->queryForListFilter($query);
  } catch (BadRequestException $e) {
    watchdog_exception('restful', $e);
  }
  $this
    ->addExtraInfoToQuery($query);
  return $query
    ->count();
}