public function ping()
{
$this->connect();
if ($this->_conn instanceof PingableConnection) {
return $this->_conn->ping();
}
try {
$this->query($this->getDatabasePlatform()->getDummySelectSQL());
return true;
} catch (DBALException $e) {
return false;
}
}
/** * @return Connection */ public function getConnection() { if (false === $this->connection->ping()) { $this->connection->close(); $this->connection->connect(); } return $this->connection; }