Neos\Flow\Persistence\Doctrine\Query::getResult PHP Method

getResult() public method

Really executes the query on the database. This should only ever be executed from the QueryResult class.
public getResult ( ) : array
return array result set
    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;
        }
    }

Usage Example

 /**
  * Loads the objects this QueryResult is supposed to hold
  *
  * @return void
  */
 protected function initialize()
 {
     if (!is_array($this->rows)) {
         $this->rows = $this->query->getResult();
     }
 }