/** * Executes the query against the database and returns the result * * @return Tx_Extbase_Persistence_QueryResultInterface|array The query result object or an array if $this->getQuerySettings()->getReturnRawQueryResult() is TRUE * @api */ public function execute() { if ($this->getQuerySettings()->getReturnRawQueryResult() === TRUE) { return $this->persistenceManager->getObjectDataByQuery($this); } else { return $this->objectManager->create('Tx_Extbase_Persistence_QueryResultInterface', $this); } }
/** * Returns the first object in the result set * * @return object * @api */ public function getFirst() { if (is_array($this->queryResult)) { $queryResult = $this->queryResult; reset($queryResult); } else { $query = $this->getQuery(); $query->setLimit(1); $queryResult = $this->dataMapper->map($query->getType(), $this->persistenceManager->getObjectDataByQuery($query)); } $firstResult = current($queryResult); if ($firstResult === FALSE) { $firstResult = NULL; } return $firstResult; }