Commit 78fd4d0c authored by alexpott's avatar alexpott

Issue #2425497 by bojanz: Stop injecting the config storage to the config query

parent 48c2e66f
...@@ -607,7 +607,7 @@ services: ...@@ -607,7 +607,7 @@ services:
- [setContainer, ['@service_container']] - [setContainer, ['@service_container']]
entity.query.config: entity.query.config:
class: Drupal\Core\Config\Entity\Query\QueryFactory class: Drupal\Core\Config\Entity\Query\QueryFactory
arguments: ['@config.storage', '@config.factory'] arguments: ['@config.factory']
entity.query.sql: entity.query.sql:
class: Drupal\Core\Entity\Query\Sql\QueryFactory class: Drupal\Core\Entity\Query\Sql\QueryFactory
arguments: ['@database'] arguments: ['@database']
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace Drupal\Core\Config\Entity\Query; namespace Drupal\Core\Config\Entity\Query;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Query\QueryBase; use Drupal\Core\Entity\Query\QueryBase;
...@@ -19,13 +18,6 @@ ...@@ -19,13 +18,6 @@
*/ */
class Query extends QueryBase implements QueryInterface { class Query extends QueryBase implements QueryInterface {
/**
* The config storage used by the config entity query.
*
* @var \Drupal\Core\Config\StorageInterface
*/
protected $configStorage;
/** /**
* The config factory used by the config entity query. * The config factory used by the config entity query.
* *
...@@ -41,16 +33,13 @@ class Query extends QueryBase implements QueryInterface { ...@@ -41,16 +33,13 @@ class Query extends QueryBase implements QueryInterface {
* @param string $conjunction * @param string $conjunction
* - AND: all of the conditions on the query need to match. * - AND: all of the conditions on the query need to match.
* - OR: at least one of the conditions on the query need to match. * - OR: at least one of the conditions on the query need to match.
* @param \Drupal\Core\Config\StorageInterface $config_storage
* The actual config storage which is used to list all config items.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory. * The config factory.
* @param array $namespaces * @param array $namespaces
* List of potential namespaces of the classes belonging to this query. * List of potential namespaces of the classes belonging to this query.
*/ */
function __construct(EntityTypeInterface $entity_type, $conjunction, StorageInterface $config_storage, ConfigFactoryInterface $config_factory, array $namespaces) { function __construct(EntityTypeInterface $entity_type, $conjunction, ConfigFactoryInterface $config_factory, array $namespaces) {
parent::__construct($entity_type, $conjunction, $namespaces); parent::__construct($entity_type, $conjunction, $namespaces);
$this->configStorage = $config_storage;
$this->configFactory = $config_factory; $this->configFactory = $config_factory;
} }
...@@ -151,7 +140,7 @@ protected function loadRecords() { ...@@ -151,7 +140,7 @@ protected function loadRecords() {
} }
// If no restrictions on IDs were found, we need to parse all records. // If no restrictions on IDs were found, we need to parse all records.
else { else {
$names = $this->configStorage->listAll($prefix); $names = $this->configFactory->listAll($prefix);
} }
// Load the corresponding records. // Load the corresponding records.
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace Drupal\Core\Config\Entity\Query; namespace Drupal\Core\Config\Entity\Query;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Query\QueryBase; use Drupal\Core\Entity\Query\QueryBase;
...@@ -20,13 +19,6 @@ ...@@ -20,13 +19,6 @@
*/ */
class QueryFactory implements QueryFactoryInterface { class QueryFactory implements QueryFactoryInterface {
/**
* The config storage used by the config entity query.
*
* @var \Drupal\Core\Config\StorageInterface;
*/
protected $configStorage;
/** /**
* The config factory used by the config entity query. * The config factory used by the config entity query.
* *
...@@ -49,8 +41,7 @@ class QueryFactory implements QueryFactoryInterface { ...@@ -49,8 +41,7 @@ class QueryFactory implements QueryFactoryInterface {
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config storage used by the config entity query. * The config storage used by the config entity query.
*/ */
public function __construct(StorageInterface $config_storage, ConfigFactoryInterface $config_factory) { public function __construct(ConfigFactoryInterface $config_factory) {
$this->configStorage = $config_storage;
$this->configFactory = $config_factory; $this->configFactory = $config_factory;
$this->namespaces = QueryBase::getNamespaces($this); $this->namespaces = QueryBase::getNamespaces($this);
} }
...@@ -59,7 +50,7 @@ public function __construct(StorageInterface $config_storage, ConfigFactoryInter ...@@ -59,7 +50,7 @@ public function __construct(StorageInterface $config_storage, ConfigFactoryInter
* {@inheritdoc} * {@inheritdoc}
*/ */
public function get(EntityTypeInterface $entity_type, $conjunction) { public function get(EntityTypeInterface $entity_type, $conjunction) {
return new Query($entity_type, $conjunction, $this->configStorage, $this->configFactory, $this->namespaces); return new Query($entity_type, $conjunction, $this->configFactory, $this->namespaces);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment