You are here

public function Connection::__construct in Drupal 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
  2. 8 core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::__construct()
  3. 8 core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php \Drupal\Core\Database\Driver\pgsql\Connection::__construct()
  4. 8 core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::__construct()
  5. 8 core/modules/system/tests/modules/driver_test/src/Driver/Database/DrivertestMysqlDeprecatedVersion/Connection.php \Drupal\driver_test\Driver\Database\DrivertestMysqlDeprecatedVersion\Connection::__construct()

Constructs a Connection object.

Overrides Connection::__construct

File

core/modules/system/tests/modules/driver_test/src/Driver/Database/DrivertestMysqlDeprecatedVersion/Connection.php, line 15

Class

Connection
MySQL test implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\driver_test\Driver\Database\DrivertestMysqlDeprecatedVersion

Code

public function __construct(\PDO $connection, array $connection_options = []) {

  // Alias the MySQL classes to avoid having unnecessary copies.
  foreach ([
    'Delete',
    'Insert',
    'Merge',
    'Schema',
    'Upsert',
    'Select',
    'Update',
  ] as $class) {
    class_alias('Drupal\\Core\\Database\\Driver\\mysql\\' . $class, 'Drupal\\driver_test\\Driver\\Database\\DrivertestMysqlDeprecatedVersion\\' . $class);
  }
  parent::__construct($connection, $connection_options);
}