Connection::__construct

public Connection::__construct(\PDO $connection, array $connection_options)

Constructs a Connection object.

Parameters

\PDO $connection: An object of the PDO class representing a database connection.

array $connection_options: An array of options for the connection. May include the following:

  • prefix
  • namespace
  • Other driver-specific options.

File

core/lib/Drupal/Core/Database/Connection.php, line 154

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function __construct(\PDO $connection, array $connection_options) {
  // Initialize and prepare the connection prefix.
  $this->setPrefix(isset($connection_options['prefix']) ? $connection_options['prefix'] : '');

  // Set a Statement class, unless the driver opted out.
  if (!empty($this->statementClass)) {
    $connection->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this)));
  }

  $this->connection = $connection;
  $this->connectionOptions = $connection_options;
}
doc_Drupal
2016-10-29 08:56:05
Comments
Leave a Comment

Please login to continue.