public function getResult()
{
try {
$query = $this->queryBuilder->getQuery();
if ($this->cacheResult === true || $this->settings['cacheAllQueryResults']) {
$query->useResultCache(true);
}
return $query->getResult();
} catch (\Doctrine\ORM\ORMException $ormException) {
$this->systemLogger->logException($ormException);
return [];
} catch (\Doctrine\DBAL\DBALException $dbalException) {
$this->systemLogger->logException($dbalException);
if (stripos($dbalException->getMessage(), 'no database selected') !== false) {
$message = 'No database name was specified in the configuration.';
$exception = new Exception\DatabaseConnectionException($message, $dbalException->getCode());
} elseif (stripos($dbalException->getMessage(), 'table') !== false && stripos($dbalException->getMessage(), 'not') !== false && stripos($dbalException->getMessage(), 'exist') !== false) {
$message = 'A table or view seems to be missing from the database.';
$exception = new Exception\DatabaseStructureException($message, $dbalException->getCode());
} else {
$message = 'An error occurred in the Database Abstraction Layer.';
$exception = new Exception\DatabaseException($message, $dbalException->getCode());
}
throw $exception;
} catch (\PDOException $pdoException) {
$this->systemLogger->logException($pdoException);
if (stripos($pdoException->getMessage(), 'unknown database') !== false || stripos($pdoException->getMessage(), 'database') !== false && strpos($pdoException->getMessage(), 'not') !== false && strpos($pdoException->getMessage(), 'exist') !== false) {
$message = 'The database which was specified in the configuration does not exist.';
$exception = new Exception\DatabaseConnectionException($message, $pdoException->getCode());
} elseif (stripos($pdoException->getMessage(), 'access denied') !== false || stripos($pdoException->getMessage(), 'connection refused') !== false) {
$message = 'The database username / password specified in the configuration seem to be wrong.';
$exception = new Exception\DatabaseConnectionException($message, $pdoException->getCode());
} else {
$message = 'An error occurred while using the PDO Driver: ' . $pdoException->getMessage();
$exception = new Exception\DatabaseException($message, $pdoException->getCode());
}
throw $exception;
}
}