function Query::__construct

Same name in this branch
  1. 8.9.x core/lib/Drupal/Core/Config/Entity/Query/Query.php \Drupal\Core\Config\Entity\Query\Query::__construct()
  2. 8.9.x core/lib/Drupal/Core/Database/Query/Query.php \Drupal\Core\Database\Query\Query::__construct()
  3. 8.9.x core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php \Drupal\Core\Entity\KeyValueStore\Query\Query::__construct()
Same name in other branches
  1. 7.x includes/database/query.inc \Query::__construct()
  2. 9 core/lib/Drupal/Core/Config/Entity/Query/Query.php \Drupal\Core\Config\Entity\Query\Query::__construct()
  3. 9 core/lib/Drupal/Core/Database/Query/Query.php \Drupal\Core\Database\Query\Query::__construct()
  4. 9 core/lib/Drupal/Core/Entity/Query/Sql/Query.php \Drupal\Core\Entity\Query\Sql\Query::__construct()
  5. 9 core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php \Drupal\Core\Entity\KeyValueStore\Query\Query::__construct()
  6. 10 core/lib/Drupal/Core/Config/Entity/Query/Query.php \Drupal\Core\Config\Entity\Query\Query::__construct()
  7. 10 core/lib/Drupal/Core/Database/Query/Query.php \Drupal\Core\Database\Query\Query::__construct()
  8. 10 core/lib/Drupal/Core/Entity/Query/Sql/Query.php \Drupal\Core\Entity\Query\Sql\Query::__construct()
  9. 10 core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php \Drupal\Core\Entity\KeyValueStore\Query\Query::__construct()
  10. 11.x core/lib/Drupal/Core/Config/Entity/Query/Query.php \Drupal\Core\Config\Entity\Query\Query::__construct()
  11. 11.x core/lib/Drupal/Core/Database/Query/Query.php \Drupal\Core\Database\Query\Query::__construct()
  12. 11.x core/lib/Drupal/Core/Entity/Query/Sql/Query.php \Drupal\Core\Entity\Query\Sql\Query::__construct()
  13. 11.x core/lib/Drupal/Core/Entity/KeyValueStore/Query/Query.php \Drupal\Core\Entity\KeyValueStore\Query\Query::__construct()

Constructs a query 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.

\Drupal\Core\Database\Connection $connection: The database connection to run the query against.

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

Overrides QueryBase::__construct

File

core/lib/Drupal/Core/Entity/Query/Sql/Query.php, line 69

Class

Query
The SQL storage entity query class.

Namespace

Drupal\Core\Entity\Query\Sql

Code

public function __construct(EntityTypeInterface $entity_type, $conjunction, Connection $connection, array $namespaces) {
    parent::__construct($entity_type, $conjunction, $namespaces);
    $this->connection = $connection;
}

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