protected function findPdoConnection($driver, $host, $username, $password)
{
if (!is_null($this->connection)) {
return $this->connection;
}
switch ($driver) {
case 'sqlite':
case 'mysql':
case 'psgql':
case 'sqlsrv':
return new \PDO("{$driver}:host={$host}", $username, $password);
}
throw new \Exception("Could not create connection for driver " . $driver);
}