You are here

public function QueryBase::__construct in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Query/QueryBase.php \Drupal\Core\Entity\Query\QueryBase::__construct()
  2. 9 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.

File

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

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);
  }
}