function QueryBase::__construct

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/Query/QueryBase.php \Drupal\Core\Entity\Query\QueryBase::__construct()
  2. 10 core/lib/Drupal/Core/Entity/Query/QueryBase.php \Drupal\Core\Entity\Query\QueryBase::__construct()
  3. 11.x core/lib/Drupal/Core/Entity/Query/QueryBase.php \Drupal\Core\Entity\Query\QueryBase::__construct()

Constructs this object.

Parameters

\Drupal\Core\Entity\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.

array $namespaces: List of potential namespaces of the classes belonging to this query.

3 calls to QueryBase::__construct()
Query::__construct in core/lib/Drupal/Core/Config/Entity/Query/Query.php
Constructs a Query object.
Query::__construct in core/lib/Drupal/Core/Entity/Query/Sql/Query.php
Constructs a query object.
Query::__construct in core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php
Constructs a new Query.
3 methods override QueryBase::__construct()
Query::__construct in core/lib/Drupal/Core/Config/Entity/Query/Query.php
Constructs a Query object.
Query::__construct in core/lib/Drupal/Core/Entity/Query/Sql/Query.php
Constructs a query object.
Query::__construct in core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php
Constructs a new Query.

File

core/lib/Drupal/Core/Entity/Query/QueryBase.php, line 150

Class

QueryBase
The base entity query class.

Namespace

Drupal\Core\Entity\Query

Code

public function __construct(EntityTypeInterface $entity_type, $conjunction, array $namespaces) {
    $this->entityTypeId = $entity_type->id();
    $this->entityType = $entity_type;
    $this->conjunction = $conjunction;
    $this->namespaces = $namespaces;
    $this->condition = $this->conditionGroupFactory($conjunction);
    if ($this instanceof QueryAggregateInterface) {
        $this->conditionAggregate = $this->conditionAggregateGroupFactory($conjunction);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.