diff --git a/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php index 56a0784..2658aa2 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php @@ -158,6 +158,7 @@ public function getQueryServicename(); * Returns an entity query instance. * * @param string $conjunction + * (optional) The logical operator for the query, either: * - AND: all of the conditions on the query need to match. * - OR: at least one of the conditions on the query need to match. * diff --git a/core/modules/block/lib/Drupal/block/BlockFormController.php b/core/modules/block/lib/Drupal/block/BlockFormController.php index 08bf090..4ce4c81 100644 --- a/core/modules/block/lib/Drupal/block/BlockFormController.php +++ b/core/modules/block/lib/Drupal/block/BlockFormController.php @@ -11,7 +11,6 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityFormController; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\language\ConfigurableLanguageManagerInterface; @@ -37,13 +36,6 @@ class BlockFormController extends EntityFormController { protected $storageController; /** - * The entity query factory. - * - * @var \Drupal\Core\Entity\Query\QueryFactory - */ - protected $entityQueryFactory; - - /** * The language manager. * * @var \Drupal\Core\Language\LanguageManagerInterface @@ -62,16 +54,13 @@ class BlockFormController extends EntityFormController { * * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. - * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory - * The entity query factory. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. */ - public function __construct(EntityManagerInterface $entity_manager, QueryFactory $entity_query_factory, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory) { + public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory) { $this->storageController = $entity_manager->getStorageController('block'); - $this->entityQueryFactory = $entity_query_factory; $this->languageManager = $language_manager; $this->configFactory = $config_factory; } @@ -82,7 +71,6 @@ public function __construct(EntityManagerInterface $entity_manager, QueryFactory public static function create(ContainerInterface $container) { return new static( $container->get('entity.manager'), - $container->get('entity.query'), $container->get('language_manager'), $container->get('config.factory') ); @@ -373,7 +361,7 @@ public function getUniqueMachineName(BlockInterface $block) { $suggestion = $block->getPlugin()->getMachineNameSuggestion(); // Get all the blocks which starts with the suggested machine name. - $query = $this->entityQueryFactory->get('block'); + $query = $this->storageController->getQuery(); $query->condition('id', $suggestion, 'CONTAINS'); $block_ids = $query->execute(); diff --git a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php index 5fed1db..e2ce52a 100644 --- a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php +++ b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php @@ -13,7 +13,6 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Datetime\Date; use Drupal\Core\Entity\EntityManager; -use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -38,13 +37,6 @@ class CommentAdminOverview extends FormBase { protected $commentStorage; /** - * The entity query service. - * - * @var \Drupal\Core\Entity\Query\QueryFactory - */ - protected $entityQuery; - - /** * Date service object. * * @var \Drupal\Core\Datetime\Date @@ -65,17 +57,14 @@ class CommentAdminOverview extends FormBase { * The entity manager service. * @param \Drupal\comment\CommentStorageControllerInterface $comment_storage * The comment storage. - * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query - * The entity query service. * @param \Drupal\Core\Datetime\Date $date * The date service. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct(EntityManager $entity_manager, CommentStorageControllerInterface $comment_storage, QueryFactory $entity_query, Date $date, ModuleHandlerInterface $module_handler) { + public function __construct(EntityManager $entity_manager, CommentStorageControllerInterface $comment_storage, Date $date, ModuleHandlerInterface $module_handler) { $this->entityManager = $entity_manager; $this->commentStorage = $comment_storage; - $this->entityQuery = $entity_query; $this->date = $date; $this->moduleHandler = $module_handler; } @@ -87,7 +76,6 @@ public static function create(ContainerInterface $container) { return new static( $container->get('entity.manager'), $container->get('entity.manager')->getStorageController('comment'), - $container->get('entity.query'), $container->get('date'), $container->get('module_handler') ); @@ -167,7 +155,7 @@ public function buildForm(array $form, array &$form_state, $type = 'new') { ), 'operations' => $this->t('Operations'), ); - $cids = $this->entityQuery->get('comment') + $cids = $this->commentStorage->getQuery() ->condition('status', $status) ->tableSort($header) ->pager(50) diff --git a/core/modules/menu/lib/Drupal/menu/MenuFormController.php b/core/modules/menu/lib/Drupal/menu/MenuFormController.php index d6720a7..c2c86fc 100644 --- a/core/modules/menu/lib/Drupal/menu/MenuFormController.php +++ b/core/modules/menu/lib/Drupal/menu/MenuFormController.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Entity\EntityFormController; -use Drupal\Core\Entity\Query\QueryFactory; +use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Language\Language; use Drupal\menu_link\MenuLinkStorageControllerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -20,11 +20,11 @@ class MenuFormController extends EntityFormController { /** - * The factory for entity queries. + * The menu storage controller. * - * @var \Drupal\Core\Entity\Query\QueryFactory + * @var \Drupal\Core\Entity\EntityStorageControllerInterface */ - protected $entityQueryFactory; + protected $menuStorage; /** * The menu link storage controller. @@ -43,13 +43,13 @@ class MenuFormController extends EntityFormController { /** * Constructs a MenuFormController object. * - * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory - * The factory for entity queries. + * @param \Drupal\Core\Entity\EntityStorageControllerInterface $menu_storage + * The menu storage controller. * @param \Drupal\menu_link\MenuLinkStorageControllerInterface $menu_link_storage * The menu link storage controller. */ - public function __construct(QueryFactory $entity_query_factory, MenuLinkStorageControllerInterface $menu_link_storage) { - $this->entityQueryFactory = $entity_query_factory; + public function __construct(EntityStorageControllerInterface $menu_storage, MenuLinkStorageControllerInterface $menu_link_storage) { + $this->menuStorage = $menu_storage; $this->menuLinkStorage = $menu_link_storage; } @@ -57,9 +57,10 @@ public function __construct(QueryFactory $entity_query_factory, MenuLinkStorageC * {@inheritdoc} */ public static function create(ContainerInterface $container) { + $entity_manager = $container->get('entity.manager'); return new static( - $container->get('entity.query'), - $container->get('entity.manager')->getStorageController('menu_link') + $$entity_manager->getStorageController('menu'), + $$entity_manager->getStorageController('menu_link') ); } @@ -151,12 +152,12 @@ public function form(array $form, array &$form_state) { */ public function menuNameExists($value) { // Check first to see if a menu with this ID exists. - if ($this->entityQueryFactory->get('menu')->condition('id', $value)->range(0, 1)->count()->execute()) { + if ($this->menuStorage->getQuery()->condition('id', $value)->range(0, 1)->count()->execute()) { return TRUE; } // Check for a link assigned to this menu. - return $this->entityQueryFactory->get('menu_link')->condition('menu_name', $value)->range(0, 1)->count()->execute(); + return $this->menuLinkStorage->getQuery()->condition('menu_name', $value)->range(0, 1)->count()->execute(); } /** @@ -244,7 +245,7 @@ protected function buildOverviewForm(array &$form, array &$form_state) { $form['#attached']['css'] = array(drupal_get_path('module', 'menu') . '/css/menu.admin.css'); $links = array(); - $query = $this->entityQueryFactory->get('menu_link') + $query = $this->menuLinkStorage->getQuery() ->condition('menu_name', $this->entity->id()); for ($i = 1; $i <= MENU_MAX_DEPTH; $i++) { $query->sort('p' . $i, 'ASC');