Commit e58e520b authored by catch's avatar catch

Revert "Issue #3015691 by mondrake: entityQueryAggregate queries cannot be executed more than once"

This reverts commit 77accaed.
parent 77accaed
...@@ -21,13 +21,6 @@ class Query extends QueryBase implements QueryInterface { ...@@ -21,13 +21,6 @@ class Query extends QueryBase implements QueryInterface {
*/ */
protected $sqlQuery; protected $sqlQuery;
/**
* The Tables object for this query.
*
* @var \Drupal\Core\Entity\Query\Sql\TablesInterface
*/
protected $tables;
/** /**
* An array of fields keyed by the field alias. * An array of fields keyed by the field alias.
* *
...@@ -108,9 +101,6 @@ protected function prepare() { ...@@ -108,9 +101,6 @@ protected function prepare() {
$simple_query = FALSE; $simple_query = FALSE;
} }
$this->sqlQuery = $this->connection->select($base_table, 'base_table', ['conjunction' => $this->conjunction]); $this->sqlQuery = $this->connection->select($base_table, 'base_table', ['conjunction' => $this->conjunction]);
// Reset the tables structure, as it might have been built for a previous
// execution of this query.
$this->tables = NULL;
$this->sqlQuery->addMetaData('entity_type', $this->entityTypeId); $this->sqlQuery->addMetaData('entity_type', $this->entityTypeId);
$id_field = $this->entityType->getKey('id'); $id_field = $this->entityType->getKey('id');
// Add the key field for fetchAllKeyed(). // Add the key field for fetchAllKeyed().
......
...@@ -541,38 +541,6 @@ public function testAggregation() { ...@@ -541,38 +541,6 @@ public function testAggregation() {
} }
/**
* Tests preparing a query and executing twice.
*/
public function testRepeatedExecution() {
$query = $this->entityStorage->getAggregateQuery()
->groupBy('user_id');
$this->queryResult = $query->execute();
$this->assertResults([
['user_id' => 1],
['user_id' => 2],
['user_id' => 3],
]);
$entity = $this->entityStorage->create([
'id' => 7,
'user_id' => 4,
'field_test_1' => 42,
'field_test_2' => 68,
]);
$entity->enforceIsNew();
$entity->save();
$this->queryResult = $query->execute();
$this->assertResults([
['user_id' => 1],
['user_id' => 2],
['user_id' => 3],
['user_id' => 4],
]);
}
/** /**
* Asserts the results as expected regardless of order between and in rows. * Asserts the results as expected regardless of order between and in rows.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment