QueryAggregate.php

Same filename in this branch
  1. 9 core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php
Same filename in other branches
  1. 8.9.x core/modules/workspaces/src/EntityQuery/QueryAggregate.php
  2. 8.9.x core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php
  3. 10 core/modules/workspaces/src/EntityQuery/QueryAggregate.php
  4. 10 core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php
  5. 11.x core/modules/workspaces/src/EntityQuery/QueryAggregate.php
  6. 11.x core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php

Namespace

Drupal\workspaces\EntityQuery

File

core/modules/workspaces/src/EntityQuery/QueryAggregate.php

View source
<?php

namespace Drupal\workspaces\EntityQuery;

use Drupal\Core\Entity\Query\Sql\QueryAggregate as BaseQueryAggregate;

/**
 * Alters aggregate entity queries to use a workspace revision if possible.
 */
class QueryAggregate extends BaseQueryAggregate {
    use QueryTrait {
        prepare as traitPrepare;
    }
    
    /**
     * {@inheritdoc}
     */
    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;
    }

}

Classes

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.