class QueryFactory implements ContainerAwareInterface (View source)

deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\EntityStorageInterface::getQuery() or \Drupal\Core\Entity\EntityStorageInterface::getAggregateQuery() instead.

Factory class Creating entity query objects.

Any implementation of this service must call getQuery()/getAggregateQuery() of the corresponding entity storage.

Traits

ContainerAwareTrait

Provides a standard way to announce deprecated properties.

Properties

protected $deprecatedProperties {@inheritdoc}
protected EntityTypeManagerInterface $entityTypeManager

The entity type manager service.

Methods

__get($name)

Allows to access deprecated/removed properties.

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs a QueryFactory object.

get(string $entity_type_id, string $conjunction = 'AND')

Returns a query object for a given entity type.

getAggregate(string $entity_type_id, string $conjunction = 'AND')

Returns an aggregated query object for a given entity type.

Details

__get($name)

Allows to access deprecated/removed properties.

This method must be public.

Parameters

$name

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs a QueryFactory object.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager service.

QueryInterface get(string $entity_type_id, string $conjunction = 'AND')

Returns a query object for a given entity type.

Parameters

string $entity_type_id

The entity type ID.

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 Value

QueryInterface

The query object that can query the given entity type.

QueryAggregateInterface getAggregate(string $entity_type_id, string $conjunction = 'AND')

Returns an aggregated query object for a given entity type.

Parameters

string $entity_type_id

The entity type ID.

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 Value

QueryAggregateInterface

The aggregated query object that can query the given entity type.