diff --git a/core/core.services.yml b/core/core.services.yml index 2b27f69..6eb32c2 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -520,6 +520,8 @@ services: arguments: ['@state'] tags: - { name: event_subscriber } + # This service should not be overridden. See + # \Drupal\Core\Entity\Query\QueryFactory. entity.query: class: Drupal\Core\Entity\Query\QueryFactory arguments: ['@entity.manager'] diff --git a/core/lib/Drupal/Core/Entity/Query/QueryFactory.php b/core/lib/Drupal/Core/Entity/Query/QueryFactory.php index 5f1ab13..4a382fd 100644 --- a/core/lib/Drupal/Core/Entity/Query/QueryFactory.php +++ b/core/lib/Drupal/Core/Entity/Query/QueryFactory.php @@ -13,8 +13,17 @@ /** * Factory class Creating entity query objects. + * + * This class is marked as final since it should not be overridden in the + * container. EntityStorageBase::getQuery() accesses the storages query service + * directly without using this factory. + * + * @see \Drupal\Core\Entity\EntityStorageBase::getQuery() + * + * @todo https://www.drupal.org/node/2389335 remove entity.query service and + * replace with using the entity storage's getQuery() method. */ -class QueryFactory implements ContainerAwareInterface { +final class QueryFactory implements ContainerAwareInterface { use ContainerAwareTrait;