f8bf8f338904dc3628e320ab8adf4cbe6f36260a
[yaffs-website] / web / core / modules / workspaces / src / EntityQuery / QueryAggregate.php
1 <?php
2
3 namespace Drupal\workspaces\EntityQuery;
4
5 use Drupal\Core\Entity\Query\Sql\QueryAggregate as BaseQueryAggregate;
6
7 /**
8  * Alters aggregate entity queries to use a workspace revision if possible.
9  */
10 class QueryAggregate extends BaseQueryAggregate {
11
12   use QueryTrait {
13     prepare as traitPrepare;
14   }
15
16   /**
17    * {@inheritdoc}
18    */
19   public function prepare() {
20     // Aggregate entity queries do not return an array of entity IDs keyed by
21     // revision IDs, they only return the values of the aggregated fields, so we
22     // don't need to add any expressions like we do in
23     // \Drupal\workspaces\EntityQuery\Query::prepare().
24     $this->traitPrepare();
25
26     // Throw away the ID fields.
27     $this->sqlFields = [];
28     return $this;
29   }
30
31 }