class QueryFactory extends QueryFactory (View source)

PostgreSQL specific entity query implementation.

To add a new query implementation extending the default SQL one, add a service definition like pgsql.entity.query.sql and a factory class like this. The system will automatically find the relevant Query, QueryAggregate, Condition, ConditionAggregate, Tables classes in this namespace, in the namespace of the parent class and so on. So after creating an empty query factory class like this, it is possible to just drop in a class extending the base class in this namespace and it will be used automatically but it is optional: if a class is not extended the relevant default is used.

Properties

protected Connection $connection

The database connection to use.

from  QueryFactory
protected array $namespaces

The namespace of this class, the parent class etc.

from  QueryFactory

Methods

__construct(Connection $connection)

Constructs a QueryFactory object.

get(EntityTypeInterface $entity_type, string $conjunction)

Instantiates an entity query for a given entity type.

getAggregate(EntityTypeInterface $entity_type, string $conjunction)

Instantiates an aggregation query object for a given entity type.

Details

__construct(Connection $connection)

Constructs a QueryFactory object.

Parameters

Connection $connection

The database connection used by the entity query.

QueryInterface get(EntityTypeInterface $entity_type, string $conjunction)

Instantiates an entity query for a given entity type.

Parameters

EntityTypeInterface $entity_type

The entity type definition.

string $conjunction

The operator to use to combine conditions: 'AND' or 'OR'.

Return Value

QueryInterface

An entity query for a specific configuration entity type.

QueryAggregateInterface getAggregate(EntityTypeInterface $entity_type, string $conjunction)

Instantiates an aggregation query object for a given entity type.

Parameters

EntityTypeInterface $entity_type

The 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.

Return Value

QueryAggregateInterface

The query object that can query the given entity type.

Exceptions

QueryException