Autarky\Database\PDOInstantiator::instantiate PHP Method

instantiate() public method

public instantiate ( $dsn, $username = null, $password = null, array $options = [] )
$options array
    public function instantiate($dsn, $username = null, $password = null, array $options = array())
    {
        return new PDO($dsn, $username, $password, $options);
    }

Usage Example

 protected function makePdoInner($dsn, $username, $password, array $options, array $initCommands)
 {
     try {
         $pdo = $this->instantiator->instantiate($dsn, $username, $password, $options);
     } catch (PDOException $e) {
         $newException = new CannotConnectException($e->getMessage(), $e->getCode(), $e);
         $newException->errorInfo = $e->errorInfo;
         throw $newException;
     }
     foreach ($initCommands as $command) {
         $pdo->exec($command);
     }
     return $pdo;
 }
PDOInstantiator