makePdo() public method

Create a new PDO instance.
public makePdo ( array $config, string $connection = null ) : PDO
$config array
$connection string Name of the connection - used for exception messages
return PDO
Example #1
0
 /**
  * Get a PDO instance.
  *
  * @param  string|null $connection Null fetches the default connection.
  *
  * @return \PDO
  */
 public function getPdo($connection = null)
 {
     if ($connection === null) {
         $connection = $this->defaultConnection;
     }
     if (isset($this->instances[$connection])) {
         return $this->instances[$connection];
     }
     $config = $this->getConnectionConfig($connection);
     return $this->instances[$connection] = $this->factory->makePdo($config, $connection);
 }