/** * Executes the query against the database and returns the result * * @param $returnRawQueryResult boolean avoids the object mapping by the persistence * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array The query result object or an array if $returnRawQueryResult is TRUE * @api */ public function execute($returnRawQueryResult = FALSE) { if ($returnRawQueryResult === TRUE || $this->getQuerySettings()->getReturnRawQueryResult() === TRUE) { return $this->persistenceManager->getObjectDataByQuery($this); } else { return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface', $this); } }
/** * Executes the query against the database and returns the result * * @param bool $returnRawQueryResult avoids the object mapping by the persistence * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array The query result object or an array if $returnRawQueryResult is TRUE * @api */ public function execute($returnRawQueryResult = false) { if ($returnRawQueryResult) { return $this->persistenceManager->getObjectDataByQuery($this); } else { return $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface::class, $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; }