Commit 03a4497f authored by webchick's avatar webchick

Issue #1862300 by tim.plunkett, dawehner, YesCT: Move...

Issue #1862300 by tim.plunkett, dawehner, YesCT: Move ConfigStorageController::getQuery() to EntityStorageControllerInterface.
parent d386581c
...@@ -65,13 +65,6 @@ class ConfigStorageController extends EntityStorageControllerBase implements Con ...@@ -65,13 +65,6 @@ class ConfigStorageController extends EntityStorageControllerBase implements Con
*/ */
protected $configStorage; protected $configStorage;
/**
* The entity query factory.
*
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $entityQueryFactory;
/** /**
* Constructs a ConfigStorageController object. * Constructs a ConfigStorageController object.
* *
...@@ -81,12 +74,10 @@ class ConfigStorageController extends EntityStorageControllerBase implements Con ...@@ -81,12 +74,10 @@ class ConfigStorageController extends EntityStorageControllerBase implements Con
* The config factory service. * The config factory service.
* @param \Drupal\Core\Config\StorageInterface $config_storage * @param \Drupal\Core\Config\StorageInterface $config_storage
* The config storage service. * The config storage service.
* @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory
* The entity query factory.
* @param \Drupal\Component\Uuid\UuidInterface $uuid_service * @param \Drupal\Component\Uuid\UuidInterface $uuid_service
* The UUID service. * The UUID service.
*/ */
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service) { public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, UuidInterface $uuid_service) {
parent::__construct($entity_type); parent::__construct($entity_type);
$this->idKey = $this->entityType->getKey('id'); $this->idKey = $this->entityType->getKey('id');
...@@ -94,7 +85,6 @@ public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInter ...@@ -94,7 +85,6 @@ public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInter
$this->configFactory = $config_factory; $this->configFactory = $config_factory;
$this->configStorage = $config_storage; $this->configStorage = $config_storage;
$this->entityQueryFactory = $entity_query_factory;
$this->uuidService = $uuid_service; $this->uuidService = $uuid_service;
} }
...@@ -106,7 +96,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI ...@@ -106,7 +96,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
$entity_type, $entity_type,
$container->get('config.factory'), $container->get('config.factory'),
$container->get('config.storage'), $container->get('config.storage'),
$container->get('entity.query'),
$container->get('uuid') $container->get('uuid')
); );
} }
...@@ -172,13 +161,6 @@ public function deleteRevision($revision_id) { ...@@ -172,13 +161,6 @@ public function deleteRevision($revision_id) {
return NULL; return NULL;
} }
/**
* {@inheritdoc}
*/
public function getQuery($conjunction = 'AND') {
return $this->entityQueryFactory->get($this->entityTypeId, $conjunction);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -30,20 +30,6 @@ interface ConfigStorageControllerInterface extends EntityStorageControllerInterf ...@@ -30,20 +30,6 @@ interface ConfigStorageControllerInterface extends EntityStorageControllerInterf
*/ */
public function importCreate($name, Config $new_config, Config $old_config); public function importCreate($name, Config $new_config, Config $old_config);
/**
* Returns an entity query instance.
*
* @param string $conjunction
* - AND: all of the conditions on the query need to match.
* - OR: at least one of the conditions on the query need to match.
*
* @return \Drupal\Core\Entity\Query\QueryInterface
* The query instance.
*
* @see \Drupal\Core\Entity\EntityStorageControllerInterface::getQueryServicename()
*/
public function getQuery($conjunction = 'AND');
/** /**
* Updates configuration upon synchronizing configuration changes. * Updates configuration upon synchronizing configuration changes.
* *
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\Core\Entity; namespace Drupal\Core\Entity;
use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* A base entity storage controller class. * A base entity storage controller class.
...@@ -194,10 +195,17 @@ protected function buildPropertyQuery(QueryInterface $entity_query, array $value ...@@ -194,10 +195,17 @@ protected function buildPropertyQuery(QueryInterface $entity_query, array $value
*/ */
public function loadByProperties(array $values = array()) { public function loadByProperties(array $values = array()) {
// Build a query to fetch the entity IDs. // Build a query to fetch the entity IDs.
$entity_query = \Drupal::entityQuery($this->entityTypeId); $entity_query = $this->getQuery();
$this->buildPropertyQuery($entity_query, $values); $this->buildPropertyQuery($entity_query, $values);
$result = $entity_query->execute(); $result = $entity_query->execute();
return $result ? $this->loadMultiple($result) : array(); return $result ? $this->loadMultiple($result) : array();
} }
/**
* {@inheritdoc}
*/
public function getQuery($conjunction = 'AND') {
return \Drupal::entityQuery($this->getEntityTypeId(), $conjunction);
}
} }
...@@ -154,6 +154,21 @@ public function save(EntityInterface $entity); ...@@ -154,6 +154,21 @@ public function save(EntityInterface $entity);
*/ */
public function getQueryServicename(); 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.
*
* @return \Drupal\Core\Entity\Query\QueryInterface
* The query instance.
*
* @see \Drupal\Core\Entity\EntityStorageControllerInterface::getQueryServicename()
*/
public function getQuery($conjunction = 'AND');
/** /**
* Returns the entity type ID. * Returns the entity type ID.
* *
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
use Drupal\aggregator\FeedStorageControllerInterface; use Drupal\aggregator\FeedStorageControllerInterface;
use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Guzzle\Http\Exception\RequestException; use Guzzle\Http\Exception\RequestException;
...@@ -21,13 +20,6 @@ ...@@ -21,13 +20,6 @@
*/ */
class OpmlFeedAdd extends FormBase { class OpmlFeedAdd extends FormBase {
/**
* The entity query factory object.
*
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $queryFactory;
/** /**
* The feed storage. * The feed storage.
* *
...@@ -45,15 +37,12 @@ class OpmlFeedAdd extends FormBase { ...@@ -45,15 +37,12 @@ class OpmlFeedAdd extends FormBase {
/** /**
* Constructs a database object. * Constructs a database object.
* *
* @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
* The entity query object.
* @param \Drupal\aggregator\FeedStorageControllerInterface $feed_storage * @param \Drupal\aggregator\FeedStorageControllerInterface $feed_storage
* The feed storage. * The feed storage.
* @param \Guzzle\Http\ClientInterface $http_client * @param \Guzzle\Http\ClientInterface $http_client
* The Guzzle HTTP client. * The Guzzle HTTP client.
*/ */
public function __construct(QueryFactory $query_factory, FeedStorageControllerInterface $feed_storage, ClientInterface $http_client) { public function __construct(FeedStorageControllerInterface $feed_storage, ClientInterface $http_client) {
$this->queryFactory = $query_factory;
$this->feedStorageController = $feed_storage; $this->feedStorageController = $feed_storage;
$this->httpClient = $http_client; $this->httpClient = $http_client;
} }
...@@ -63,7 +52,6 @@ public function __construct(QueryFactory $query_factory, FeedStorageControllerIn ...@@ -63,7 +52,6 @@ public function __construct(QueryFactory $query_factory, FeedStorageControllerIn
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('entity.query'),
$container->get('entity.manager')->getStorageController('aggregator_feed'), $container->get('entity.manager')->getStorageController('aggregator_feed'),
$container->get('http_default_client') $container->get('http_default_client')
); );
...@@ -164,7 +152,7 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -164,7 +152,7 @@ public function submitForm(array &$form, array &$form_state) {
} }
// Check for duplicate titles or URLs. // Check for duplicate titles or URLs.
$query = $this->queryFactory->get('aggregator_feed'); $query = $this->feedStorageController->getQuery();
$condition = $query->orConditionGroup() $condition = $query->orConditionGroup()
->condition('title', $feed['title']) ->condition('title', $feed['title'])
->condition('url', $feed['url']); ->condition('url', $feed['url']);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityFormController; use Drupal\Core\Entity\EntityFormController;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\language\ConfigurableLanguageManagerInterface;
...@@ -36,13 +35,6 @@ class BlockFormController extends EntityFormController { ...@@ -36,13 +35,6 @@ class BlockFormController extends EntityFormController {
*/ */
protected $storageController; protected $storageController;
/**
* The entity query factory.
*
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $entityQueryFactory;
/** /**
* The language manager. * The language manager.
* *
...@@ -62,16 +54,13 @@ class BlockFormController extends EntityFormController { ...@@ -62,16 +54,13 @@ class BlockFormController extends EntityFormController {
* *
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The 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 * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager. * The language manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The 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->storageController = $entity_manager->getStorageController('block');
$this->entityQueryFactory = $entity_query_factory;
$this->languageManager = $language_manager; $this->languageManager = $language_manager;
$this->configFactory = $config_factory; $this->configFactory = $config_factory;
} }
...@@ -82,7 +71,6 @@ public function __construct(EntityManagerInterface $entity_manager, QueryFactory ...@@ -82,7 +71,6 @@ public function __construct(EntityManagerInterface $entity_manager, QueryFactory
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('entity.manager'), $container->get('entity.manager'),
$container->get('entity.query'),
$container->get('language_manager'), $container->get('language_manager'),
$container->get('config.factory') $container->get('config.factory')
); );
...@@ -373,7 +361,7 @@ public function getUniqueMachineName(BlockInterface $block) { ...@@ -373,7 +361,7 @@ public function getUniqueMachineName(BlockInterface $block) {
$suggestion = $block->getPlugin()->getMachineNameSuggestion(); $suggestion = $block->getPlugin()->getMachineNameSuggestion();
// Get all the blocks which starts with the suggested machine name. // 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'); $query->condition('id', $suggestion, 'CONTAINS');
$block_ids = $query->execute(); $block_ids = $query->execute();
......
...@@ -31,7 +31,6 @@ public static function getInfo() { ...@@ -31,7 +31,6 @@ public static function getInfo() {
* @see \Drupal\block\BlockFormController::getUniqueMachineName() * @see \Drupal\block\BlockFormController::getUniqueMachineName()
*/ */
public function testGetUniqueMachineName() { public function testGetUniqueMachineName() {
$block_storage = $this->getMock('Drupal\Core\Config\Entity\ConfigStorageControllerInterface');
$blocks = array(); $blocks = array();
$blocks['test'] = $this->getBlockMockWithMachineName('test'); $blocks['test'] = $this->getBlockMockWithMachineName('test');
...@@ -39,9 +38,7 @@ public function testGetUniqueMachineName() { ...@@ -39,9 +38,7 @@ public function testGetUniqueMachineName() {
$blocks['other_test_1'] = $this->getBlockMockWithMachineName('other_test'); $blocks['other_test_1'] = $this->getBlockMockWithMachineName('other_test');
$blocks['other_test_2'] = $this->getBlockMockWithMachineName('other_test'); $blocks['other_test_2'] = $this->getBlockMockWithMachineName('other_test');
$query = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryInterface') $query = $this->getMock('Drupal\Core\Entity\Query\QueryInterface');
->disableOriginalConstructor()
->getMock();
$query->expects($this->exactly(5)) $query->expects($this->exactly(5))
->method('condition') ->method('condition')
->will($this->returnValue($query)); ->will($this->returnValue($query));
...@@ -50,12 +47,9 @@ public function testGetUniqueMachineName() { ...@@ -50,12 +47,9 @@ public function testGetUniqueMachineName() {
->method('execute') ->method('execute')
->will($this->returnValue(array('test', 'other_test', 'other_test_1', 'other_test_2'))); ->will($this->returnValue(array('test', 'other_test', 'other_test_1', 'other_test_2')));
$query_factory = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory') $block_storage = $this->getMock('Drupal\Core\Config\Entity\ConfigStorageControllerInterface');
->disableOriginalConstructor() $block_storage->expects($this->exactly(5))
->getMock(); ->method('getQuery')
$query_factory->expects($this->exactly(5))
->method('get')
->with('block', 'AND')
->will($this->returnValue($query)); ->will($this->returnValue($query));
$entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
...@@ -68,7 +62,7 @@ public function testGetUniqueMachineName() { ...@@ -68,7 +62,7 @@ public function testGetUniqueMachineName() {
$config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface'); $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
$block_form_controller = new BlockFormController($entity_manager, $query_factory, $language_manager, $config_factory); $block_form_controller = new BlockFormController($entity_manager, $language_manager, $config_factory);
// Ensure that the block with just one other instance gets the next available // Ensure that the block with just one other instance gets the next available
// name suggestion. // name suggestion.
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Datetime\Date; use Drupal\Core\Datetime\Date;
use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -37,13 +36,6 @@ class CommentAdminOverview extends FormBase { ...@@ -37,13 +36,6 @@ class CommentAdminOverview extends FormBase {
*/ */
protected $commentStorage; protected $commentStorage;
/**
* The entity query service.
*
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $entityQuery;
/** /**
* Date service object. * Date service object.
* *
...@@ -65,17 +57,14 @@ class CommentAdminOverview extends FormBase { ...@@ -65,17 +57,14 @@ class CommentAdminOverview extends FormBase {
* The entity manager service. * The entity manager service.
* @param \Drupal\comment\CommentStorageControllerInterface $comment_storage * @param \Drupal\comment\CommentStorageControllerInterface $comment_storage
* The comment storage. * The comment storage.
* @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
* The entity query service.
* @param \Drupal\Core\Datetime\Date $date * @param \Drupal\Core\Datetime\Date $date
* The date service. * The date service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The 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->entityManager = $entity_manager;
$this->commentStorage = $comment_storage; $this->commentStorage = $comment_storage;
$this->entityQuery = $entity_query;
$this->date = $date; $this->date = $date;
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
} }
...@@ -87,7 +76,6 @@ public static function create(ContainerInterface $container) { ...@@ -87,7 +76,6 @@ public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('entity.manager'), $container->get('entity.manager'),
$container->get('entity.manager')->getStorageController('comment'), $container->get('entity.manager')->getStorageController('comment'),
$container->get('entity.query'),
$container->get('date'), $container->get('date'),
$container->get('module_handler') $container->get('module_handler')
); );
...@@ -167,7 +155,7 @@ public function buildForm(array $form, array &$form_state, $type = 'new') { ...@@ -167,7 +155,7 @@ public function buildForm(array $form, array &$form_state, $type = 'new') {
), ),
'operations' => $this->t('Operations'), 'operations' => $this->t('Operations'),
); );
$cids = $this->entityQuery->get('comment') $cids = $this->commentStorage->getQuery()
->condition('status', $status) ->condition('status', $status)
->tableSort($header) ->tableSort($header)
->pager(50) ->pager(50)
......
...@@ -54,8 +54,6 @@ class FieldConfigStorageController extends ConfigStorageController { ...@@ -54,8 +54,6 @@ class FieldConfigStorageController extends ConfigStorageController {
* The config factory service. * The config factory service.
* @param \Drupal\Core\Config\StorageInterface $config_storage * @param \Drupal\Core\Config\StorageInterface $config_storage
* The config storage service. * The config storage service.
* @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory
* The entity query factory.
* @param \Drupal\Component\Uuid\UuidInterface $uuid_service * @param \Drupal\Component\Uuid\UuidInterface $uuid_service
* The UUID service. * The UUID service.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
...@@ -65,8 +63,8 @@ class FieldConfigStorageController extends ConfigStorageController { ...@@ -65,8 +63,8 @@ class FieldConfigStorageController extends ConfigStorageController {
* @param \Drupal\Core\KeyValueStore\StateInterface $state * @param \Drupal\Core\KeyValueStore\StateInterface $state
* The state key value store. * The state key value store.
*/ */
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, ModuleHandler $module_handler, StateInterface $state) { public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, ModuleHandler $module_handler, StateInterface $state) {
parent::__construct($entity_type, $config_factory, $config_storage, $entity_query_factory, $uuid_service); parent::__construct($entity_type, $config_factory, $config_storage, $uuid_service);
$this->entityManager = $entity_manager; $this->entityManager = $entity_manager;
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
$this->state = $state; $this->state = $state;
...@@ -80,7 +78,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI ...@@ -80,7 +78,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
$entity_type, $entity_type,
$container->get('config.factory'), $container->get('config.factory'),
$container->get('config.storage'), $container->get('config.storage'),
$container->get('entity.query'),
$container->get('uuid'), $container->get('uuid'),
$container->get('entity.manager'), $container->get('entity.manager'),
$container->get('module_handler'), $container->get('module_handler'),
......
...@@ -52,8 +52,6 @@ class FieldInstanceConfigStorageController extends ConfigStorageController { ...@@ -52,8 +52,6 @@ class FieldInstanceConfigStorageController extends ConfigStorageController {
* The config factory service. * The config factory service.
* @param \Drupal\Core\Config\StorageInterface $config_storage * @param \Drupal\Core\Config\StorageInterface $config_storage
* The config storage service. * The config storage service.
* @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory
* The entity query factory.
* @param \Drupal\Component\Uuid\UuidInterface $uuid_service * @param \Drupal\Component\Uuid\UuidInterface $uuid_service
* The UUID service. * The UUID service.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
...@@ -61,8 +59,8 @@ class FieldInstanceConfigStorageController extends ConfigStorageController { ...@@ -61,8 +59,8 @@ class FieldInstanceConfigStorageController extends ConfigStorageController {
* @param \Drupal\Core\KeyValueStore\StateInterface $state * @param \Drupal\Core\KeyValueStore\StateInterface $state
* The state key value store. * The state key value store.
*/ */
public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, StateInterface $state) { public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, StorageInterface $config_storage, UuidInterface $uuid_service, EntityManagerInterface $entity_manager, StateInterface $state) {
parent::__construct($entity_type, $config_factory, $config_storage, $entity_query_factory, $uuid_service); parent::__construct($entity_type, $config_factory, $config_storage, $uuid_service);
$this->entityManager = $entity_manager; $this->entityManager = $entity_manager;
$this->state = $state; $this->state = $state;
} }
...@@ -75,7 +73,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI ...@@ -75,7 +73,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
$entity_type, $entity_type,
$container->get('config.factory'), $container->get('config.factory'),
$container->get('config.storage'), $container->get('config.storage'),
$container->get('entity.query'),
$container->get('uuid'), $container->get('uuid'),
$container->get('entity.manager'), $container->get('entity.manager'),
$container->get('state') $container->get('state')
......
...@@ -166,7 +166,7 @@ public function updateParentalStatus(EntityInterface $entity, $exclude = FALSE) ...@@ -166,7 +166,7 @@ public function updateParentalStatus(EntityInterface $entity, $exclude = FALSE)
// If plid == 0, there is nothing to update. // If plid == 0, there is nothing to update.
if ($entity->plid) { if ($entity->plid) {
// Check if at least one visible child exists in the table. // Check if at least one visible child exists in the table.
$query = \Drupal::entityQuery($this->entityTypeId); $query = $this->getQuery();
$query $query
->condition('menu_name', $entity->menu_name) ->condition('menu_name', $entity->menu_name)
->condition('hidden', 0) ->condition('hidden', 0)
...@@ -259,7 +259,7 @@ public function moveChildren(EntityInterface $entity) { ...@@ -259,7 +259,7 @@ public function moveChildren(EntityInterface $entity) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function countMenuLinks($menu_name) { public function countMenuLinks($menu_name) {
$query = \Drupal::entityQuery($this->entityTypeId); $query = $this->getQuery();
$query $query
->condition('menu_name', $menu_name) ->condition('menu_name', $menu_name)
->count(); ->count();
...@@ -275,7 +275,7 @@ public function getParentFromHierarchy(EntityInterface $entity) { ...@@ -275,7 +275,7 @@ public function getParentFromHierarchy(EntityInterface $entity) {
$parent = FALSE; $parent = FALSE;
$parent_path = substr($parent_path, 0, strrpos($parent_path, '/')); $parent_path = substr($parent_path, 0, strrpos($parent_path, '/'));
$query = \Drupal::entityQuery($this->entityTypeId); $query = $this->getQuery();
$query $query
->condition(