summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Entity/EntityStorageBase.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/lib/Drupal/Core/Entity/EntityStorageBase.php')
-rw-r--r--core/lib/Drupal/Core/Entity/EntityStorageBase.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
index 4a40a9e..4333c47 100644
--- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
@@ -460,7 +460,26 @@ abstract class EntityStorageBase extends EntityHandlerBase implements EntityStor
* {@inheritdoc}
*/
public function getQuery($conjunction = 'AND') {
- return \Drupal::entityQuery($this->getEntityTypeId(), $conjunction);
+ // Access the service directly rather than entity.query factory so the
+ // storage's current entity type is used.
+ return \Drupal::service($this->getQueryServiceName())->get($this->entityType, $conjunction);
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getAggregateQuery($conjunction = 'AND') {
+ // Access the service directly rather than entity.query factory so the
+ // storage's current entity type is used.
+ return \Drupal::service($this->getQueryServiceName())->getAggregate($this->entityType, $conjunction);
+ }
+
+ /**
+ * Gets the name of the service for the query for this entity storage.
+ *
+ * @return string
+ * The name of the service for the query for this entity storage.
+ */
+ abstract protected function getQueryServiceName();
+
}