Neos\Flow\Persistence\Generic\QueryResult::getFirst PHP Method

getFirst() public method

Returns the first object in the result set, if any.
public getFirst ( ) : mixed
return mixed The first object of the result set or NULL if the result set was empty
    public function getFirst()
    {
        if (is_array($this->queryResult)) {
            $queryResult =& $this->queryResult;
        } else {
            $query = clone $this->query;
            $query->setLimit(1);
            $queryResult = $this->dataMapper->mapToObjects($this->persistenceManager->getObjectDataByQuery($query));
        }
        return isset($queryResult[0]) ? $queryResult[0] : null;
    }