summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Entity/Query/Sql/Query.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/lib/Drupal/Core/Entity/Query/Sql/Query.php')
-rw-r--r--core/lib/Drupal/Core/Entity/Query/Sql/Query.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php
index cf8eb39..6269617 100644
--- a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php
+++ b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php
@@ -9,7 +9,6 @@ namespace Drupal\Core\Entity\Query\Sql;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Query\QueryBase;
use Drupal\Core\Entity\Query\QueryException;
@@ -100,8 +99,15 @@ class Query extends QueryBase implements QueryInterface {
* Returns the called object.
*/
protected function prepare() {
- if (!$base_table = $this->entityType->getBaseTable()) {
- throw new QueryException("No base table, invalid query.");
+ if ($this->allRevisions) {
+ if (!$base_table = $this->entityType->getRevisionTable()) {
+ throw new QueryException("No revision table for " . $this->entityTypeId . ", invalid query.");
+ }
+ }
+ else {
+ if (!$base_table = $this->entityType->getBaseTable()) {
+ throw new QueryException("No base table for " . $this->entityTypeId . ", invalid query.");
+ }
}
$simple_query = TRUE;
if ($this->entityType->getDataTable()) {
@@ -146,7 +152,7 @@ class Query extends QueryBase implements QueryInterface {
}
// This now contains first the table containing entity properties and
// last the entity base table. They might be the same.
- $this->sqlQuery->addMetaData('age', $this->age);
+ $this->sqlQuery->addMetaData('all_revisions', $this->allRevisions);
$this->sqlQuery->addMetaData('simple_query', $simple_query);
return $this;
}