Drupal 8  8.0.2
QueryFactory Class Reference
Inheritance diagram for QueryFactory:

Public Member Functions

 __construct (ConfigFactoryInterface $config_factory, KeyValueFactoryInterface $key_value, ConfigManagerInterface $config_manager)
 
 get (EntityTypeInterface $entity_type, $conjunction)
 
 getAggregate (EntityTypeInterface $entity_type, $conjunction)
 
 onConfigSave (ConfigCrudEvent $event)
 
 onConfigDelete (ConfigCrudEvent $event)
 

Static Public Member Functions

static getSubscribedEvents ()
 

Data Fields

const CONFIG_LOOKUP_PREFIX = 'config.entity.key_store.'
 

Protected Member Functions

 getConfigKeyStore (EntityTypeInterface $entity_type)
 
 updateConfigKeyStore (ConfigEntityTypeInterface $entity_type, Config $config)
 
 deleteConfigKeyStore (ConfigEntityTypeInterface $entity_type, Config $config)
 
 getKeys (Config $config, $key, $get_method, ConfigEntityTypeInterface $entity_type)
 
 getValues (Config $config, $key, $get_method, array $parts, $start=0)
 

Protected Attributes

 $configFactory
 
 $namespaces
 

Detailed Description

Provides a factory for creating entity query objects for the config backend.

Constructor & Destructor Documentation

__construct ( ConfigFactoryInterface  $config_factory,
KeyValueFactoryInterface  $key_value,
ConfigManagerInterface  $config_manager 
)

Constructs a QueryFactory object.

Parameters
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryThe config storage used by the config entity query.
\Drupal\Core\KeyValueStore\KeyValueFactoryInterface$key_valueThe key value factory.
\Drupal\Core\Config\ConfigManagerInterface$config_managerThe configuration manager.

References Drupal\configFactory(), and QueryBase\getNamespaces().

Here is the call graph for this function:

Member Function Documentation

deleteConfigKeyStore ( ConfigEntityTypeInterface  $entity_type,
Config  $config 
)
protected

Deletes lookup data.

Parameters
\Drupal\Core\Config\Entity\ConfigEntityTypeInterface$entity_typeThe entity type.
\Drupal\Core\Config\Config$configThe configuration object that is being deleted.

References QueryFactory\getConfigKeyStore(), QueryFactory\getKeys(), ConfigEntityTypeInterface\getLookupKeys(), and ConfigBase\getName().

Referenced by QueryFactory\onConfigDelete().

Here is the call graph for this function:

Here is the caller graph for this function:

get ( EntityTypeInterface  $entity_type,
  $conjunction 
)

{Instantiates an entity query for a given entity type.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition.
string$conjunctionThe operator to use to combine conditions: 'AND' or 'OR'.
Returns
An entity query for a specific configuration entity type.
}

Implements QueryFactoryInterface.

References Drupal\configFactory().

Here is the call graph for this function:

getAggregate ( EntityTypeInterface  $entity_type,
  $conjunction 
)

{Instantiates an aggregation query object for a given entity type.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition.
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.
Returns
The query object that can query the given entity type.
Exceptions
\Drupal\Core\Entity\Query\QueryException
}

Implements QueryFactoryInterface.

getConfigKeyStore ( EntityTypeInterface  $entity_type)
protected

Gets the key value store used to store fast lookups.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type.
Returns
The key value store used to store fast lookups.

References EntityTypeInterface\id().

Referenced by QueryFactory\deleteConfigKeyStore(), and QueryFactory\updateConfigKeyStore().

Here is the call graph for this function:

Here is the caller graph for this function:

getKeys ( Config  $config,
  $key,
  $get_method,
ConfigEntityTypeInterface  $entity_type 
)
protected

Creates lookup keys for configuration data.

Parameters
\Drupal\Core\Config\Config$configThe configuration object.
string$keyThe configuration key to look for.
string$get_methodWhich method on the config object to call to get the value. Either 'get' or 'getOriginal'.
\Drupal\Core\Config\Entity\ConfigEntityTypeInterface$entity_typeThe configuration entity type.
Returns
array An array of lookup keys concatenated to the configuration values.
Exceptions
\Drupal\Core\Config\Entity\Query\InvalidLookupKeyExceptionThe provided $key cannot end with a wildcard. This makes no sense since you cannot do fast lookups against this.

References QueryFactory\getValues(), and EntityTypeInterface\id().

Referenced by QueryFactory\deleteConfigKeyStore(), and QueryFactory\updateConfigKeyStore().

Here is the call graph for this function:

Here is the caller graph for this function:

static getSubscribedEvents ( )
static

{}

getValues ( Config  $config,
  $key,
  $get_method,
array  $parts,
  $start = 0 
)
protected

Finds all the values for a configuration key in a configuration object.

Parameters
\Drupal\Core\Config\Config$configThe configuration object.
string$keyThe current key being checked.
string$get_methodWhich method on the config object to call to get the value.
array$partsAll the parts of a configuration key we are checking.
int$startWhich position of $parts we are processing. Defaults to 0.
Returns
array|NULL The array of configuration values the match the provided key. NULL if the configuration object does not have a value that corresponds to the key.

Referenced by QueryFactory\getKeys().

Here is the caller graph for this function:

onConfigDelete ( ConfigCrudEvent  $event)

Removes configuration entity from key store.

Parameters
\Drupal\Core\Config\ConfigCrudEvent$eventThe configuration event.

References QueryFactory\deleteConfigKeyStore(), and ConfigCrudEvent\getConfig().

Here is the call graph for this function:

onConfigSave ( ConfigCrudEvent  $event)

Updates configuration entity in the key store.

Parameters
ConfigCrudEvent$eventThe configuration event.

References ConfigCrudEvent\getConfig(), and QueryFactory\updateConfigKeyStore().

Here is the call graph for this function:

updateConfigKeyStore ( ConfigEntityTypeInterface  $entity_type,
Config  $config 
)
protected

Updates or adds lookup data.

Parameters
\Drupal\Core\Config\Entity\ConfigEntityTypeInterface$entity_typeThe entity type.
\Drupal\Core\Config\Config$configThe configuration object that is being saved.

References QueryFactory\getConfigKeyStore(), QueryFactory\getKeys(), ConfigEntityTypeInterface\getLookupKeys(), and ConfigBase\getName().

Referenced by QueryFactory\onConfigSave().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

const CONFIG_LOOKUP_PREFIX = 'config.entity.key_store.'

The prefix for the key value collection for fast lookups.

Referenced by Query\getConfigKeyStore(), and ConfigEntityQueryTest\testLookupKeys().


The documentation for this class was generated from the following file: