/**
  * @param ForestCollection $collection
  * @return array
  */
 public function getAttributes($collection)
 {
     $ret = array();
     $ret['name'] = $collection->getName();
     $ret['fields'] = $collection->getFields();
     if ($collection->getActions()) {
         $ret['actions'] = $collection->getActions();
     }
     $ret['only-for-relationships'] = null;
     $ret['is-virtual'] = null;
     $ret['is-read-only'] = false;
     $ret['is-searchable'] = true;
     return $ret;
 }
Example #2
0
 /**
  * @param Collection $collection
  */
 public function setCollection($collection)
 {
     $this->collection = $collection;
     $this->setType($collection->getName());
 }
 /**
  * @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);
 }