/** * @param string $recordId * @param ForestCollection $collection * @param EntityRepository $repository * @return array * @throws \Doctrine\ORM\NonUniqueResultException */ protected function loadResource($recordId, $collection, $repository) { $resourceQueryBuilder = $repository->createQueryBuilder('resource')->andWhere('resource.' . $collection->getIdentifier() . ' = :identifier')->setParameter('identifier', $recordId); $resultSet = $resourceQueryBuilder->getQuery()->setHint(\Doctrine\ORM\Query::HINT_INCLUDE_META_COLUMNS, true)->getOneOrNullResult(\Doctrine\ORM\Query::HYDRATE_ARRAY); if ($resultSet) { $returnedResource = new ForestResource($collection, $this->formatResource($resultSet, $collection)); } return array($returnedResource, $resultSet); }