You are here

public function QueryAggregate::prepare in Drupal 9

Same name in this branch
  1. 9 core/modules/workspaces/src/EntityQuery/QueryAggregate.php \Drupal\workspaces\EntityQuery\QueryAggregate::prepare()
  2. 9 core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php \Drupal\Core\Entity\Query\Sql\QueryAggregate::prepare()
Same name and namespace in other branches
  1. 8 core/modules/workspaces/src/EntityQuery/QueryAggregate.php \Drupal\workspaces\EntityQuery\QueryAggregate::prepare()
  2. 10 core/modules/workspaces/src/EntityQuery/QueryAggregate.php \Drupal\workspaces\EntityQuery\QueryAggregate::prepare()

Prepares the basic query with proper metadata/tags and base fields.

Return value

$this Returns the called object.

Throws

\Drupal\Core\Entity\Query\QueryException Thrown if the base table does not exist.

Overrides QueryAggregate::prepare

File

core/modules/workspaces/src/EntityQuery/QueryAggregate.php, line 19

Class

QueryAggregate
Alters aggregate entity queries to use a workspace revision if possible.

Namespace

Drupal\workspaces\EntityQuery

Code

public function prepare() {

  // Aggregate entity queries do not return an array of entity IDs keyed by
  // revision IDs, they only return the values of the aggregated fields, so we
  // don't need to add any expressions like we do in
  // \Drupal\workspaces\EntityQuery\Query::prepare().
  $this
    ->traitPrepare();

  // Throw away the ID fields.
  $this->sqlFields = [];
  return $this;
}