Drupal 8  8.0.2
Query Class Reference
Inheritance diagram for Query:

Public Member Functions

 __construct (EntityTypeInterface $entity_type, $conjunction, ConfigFactoryInterface $config_factory, KeyValueFactoryInterface $key_value_factory, array $namespaces)
 
 condition ($property, $value=NULL, $operator=NULL, $langcode=NULL)
 
 execute ()
 
- Public Member Functions inherited from QueryBase
 __construct (EntityTypeInterface $entity_type, $conjunction, array $namespaces)
 
 getEntityTypeId ()
 
 condition ($property, $value=NULL, $operator=NULL, $langcode=NULL)
 
 exists ($property, $langcode=NULL)
 
 notExists ($property, $langcode=NULL)
 
 range ($start=NULL, $length=NULL)
 
 andConditionGroup ()
 
 orConditionGroup ()
 
 sort ($field, $direction= 'ASC', $langcode=NULL)
 
 count ()
 
 accessCheck ($access_check=TRUE)
 
 currentRevision ()
 
 allRevisions ()
 
 pager ($limit=10, $element=NULL)
 
 tableSort (&$headers)
 
 __clone ()
 
 addTag ($tag)
 
 hasTag ($tag)
 
 hasAllTags ()
 
 hasAnyTag ()
 
 addMetaData ($key, $object)
 
 getMetaData ($key)
 
 aggregate ($field, $function, $langcode=NULL, &$alias=NULL)
 
 conditionAggregate ($field, $function=NULL, $value=NULL, $operator= '=', $langcode=NULL)
 
 sortAggregate ($field, $function, $direction= 'ASC', $langcode=NULL)
 
 groupBy ($field, $langcode=NULL)
 

Protected Member Functions

 loadRecords ()
 
 getConfigKeyStore ()
 
- Protected Member Functions inherited from QueryBase
 conditionGroupFactory ($conjunction= 'AND')
 
 initializePager ()
 
 getAggregationAlias ($field, $function)
 

Protected Attributes

 $entityType
 
 $configFactory
 
 $keyValueFactory
 
- Protected Attributes inherited from QueryBase
 $entityTypeId
 
 $entityType
 
 $sort = array()
 
 $count = FALSE
 
 $condition
 
 $aggregate = array()
 
 $groupBy = array()
 
 $conditionAggregate
 
 $sortAggregate = array()
 
 $range = array()
 
 $alterMetaData
 
 $alterTags
 
 $accessCheck = TRUE
 
 $allRevisions = FALSE
 
 $pager = array()
 
 $namespaces = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from QueryBase
static getNamespaces ($object)
 
static getClass (array $namespaces, $short_class_name)
 

Detailed Description

Defines the entity query for configuration entities.

Constructor & Destructor Documentation

__construct ( EntityTypeInterface  $entity_type,
  $conjunction,
ConfigFactoryInterface  $config_factory,
KeyValueFactoryInterface  $key_value_factory,
array  $namespaces 
)

Constructs a Query object.

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.
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryThe config factory.
\Drupal\Core\KeyValueStore\KeyValueFactoryInterface$key_value_factoryThe key value factory.
array$namespacesList of potential namespaces of the classes belonging to this query.

References Drupal\configFactory().

Here is the call graph for this function:

Member Function Documentation

condition (   $property,
  $value = NULL,
  $operator = NULL,
  $langcode = NULL 
)

Overrides ::condition().

Additional to the syntax defined in the QueryInterface you can use placeholders (*) to match all keys of an subarray. Let's take the follow yaml file as example:

level1:
level2a:
level3: 1
level2b:
level3: 2

Then you can filter out via $query->condition('level1.*.level3', 1).

Implements QueryInterface.

Referenced by Query\execute(), and Query\loadRecords().

Here is the caller graph for this function:

execute ( )

{Execute the query.

Returns
int|array Returns an integer for count queries or an array of ids. The values of the array are always entity ids. The keys will be revision ids if the entity supports revision and entity ids if not.
}

Implements QueryInterface.

References Query\condition(), QueryBase\count(), QueryBase\initializePager(), Query\loadRecords(), QueryBase\range(), and QueryBase\sort().

Here is the call graph for this function:

getConfigKeyStore ( )
protected

Gets the key value store used to store fast lookups.

Returns
The key value store used to store fast lookups.

References QueryFactory\CONFIG_LOOKUP_PREFIX.

Referenced by Query\loadRecords().

Here is the caller graph for this function:

loadRecords ( )
protected

Loads the config records to examine for the query.

Returns
array Config records keyed by entity IDs.

References Query\condition(), Drupal\configFactory(), and Query\getConfigKeyStore().

Referenced by Query\execute().

Here is the call graph for this function:

Here is the caller graph for this function:


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