function Select::__construct

Same name in other branches
  1. 9 core/modules/sqlite/src/Driver/Database/sqlite/Select.php \Drupal\sqlite\Driver\Database\sqlite\Select::__construct()
  2. 9 core/modules/mysql/src/Driver/Database/mysql/Select.php \Drupal\mysql\Driver\Database\mysql\Select::__construct()
  3. 9 core/modules/pgsql/src/Driver/Database/pgsql/Select.php \Drupal\pgsql\Driver\Database\pgsql\Select::__construct()
  4. 9 core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::__construct()
  5. 8.9.x core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::__construct()
  6. 10 core/modules/sqlite/src/Driver/Database/sqlite/Select.php \Drupal\sqlite\Driver\Database\sqlite\Select::__construct()
  7. 10 core/modules/mysql/src/Driver/Database/mysql/Select.php \Drupal\mysql\Driver\Database\mysql\Select::__construct()
  8. 10 core/modules/pgsql/src/Driver/Database/pgsql/Select.php \Drupal\pgsql\Driver\Database\pgsql\Select::__construct()
  9. 10 core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::__construct()

Constructs a Select object.

Parameters

\Drupal\Core\Database\Connection $connection: Database connection object.

string|\Drupal\Core\Database\Query\SelectInterface $table: The table name or subquery that is being queried.

string $alias: The alias for the table.

array $options: Array of query options.

Overrides Query::__construct

File

core/lib/Drupal/Core/Database/Query/Select.php, line 143

Class

Select
Query builder for SELECT statements.

Namespace

Drupal\Core\Database\Query

Code

public function __construct(Connection $connection, $table, $alias = NULL, $options = []) {
    parent::__construct($connection, $options);
    $conjunction = $options['conjunction'] ?? 'AND';
    $this->condition = $this->connection
        ->condition($conjunction);
    $this->having = $this->connection
        ->condition($conjunction);
    $this->addJoin(NULL, $table, $alias);
}

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