You are here

protected function DataProviderEntity::addExtraInfoToQuery in RESTful 7.2

Adds query tags and metadata to the EntityFieldQuery.

Parameters

\EntityFieldQuery $query: The query to enhance.

Overrides DataProvider::addExtraInfoToQuery

2 calls to DataProviderEntity::addExtraInfoToQuery()
DataProviderEntity::getQueryCount in src/Plugin/resource/DataProvider/DataProviderEntity.php
Prepare a query for RestfulEntityBase::count().
DataProviderEntity::getQueryForList in src/Plugin/resource/DataProvider/DataProviderEntity.php
Prepare a query for RestfulEntityBase::getList().

File

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

Class

DataProviderEntity
Class DataProviderEntity.

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

protected function addExtraInfoToQuery($query) {
  parent::addExtraInfoToQuery($query);

  // The only time you need to add the access tags to a EFQ is when you don't
  // have fieldConditions.
  if (empty($query->fieldConditions) && empty($query->order)) {

    // Add a generic entity access tag to the query.
    $query
      ->addTag($this->entityType . '_access');
  }
  $query
    ->addMetaData('restful_data_provider', $this);
}