public function getConnection()
{
try {
if ($this->connection === null) {
$this->connection = new \PDO($this->dsn, $this->user, $this->password, $this->options);
$this->setupConnection($this->connection);
}
return $this->connection;
} catch (\Exception $e) {
throw new Exception(sprintf("error creating PDO [%s], message: [%s]", $this->dsn, $e->getMessage()), Exception::PERSISTENCE_FAILED_TO_CONNECT);
}
}