Neos\Flow\Persistence\Generic\DataMapper::mapToObjects PHP Method

mapToObjects() public method

Note: QueryResult relies on the fact that the first object of $objects has the numeric index "0"
public mapToObjects ( array $objectsData ) : array
$objectsData array
return array
    public function mapToObjects(array $objectsData)
    {
        $objects = [];
        foreach ($objectsData as $objectData) {
            $objects[] = $this->mapToObject($objectData);
        }
        return $objects;
    }

Usage Example

 /**
  * Returns the first object in the result set, if any.
  *
  * @return mixed The first object of the result set or NULL if the result set was empty
  * @api
  */
 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;
 }