public function getEntityById($type, $id) { $finder = FinderFactory::createFinderWithType($type); if ($finder === null) { throw Exception('Invalid type'); } $object = $finder->findById($id); return $object; }
public function actionResources() { $resourceFinder = FinderFactory::createFinderWithType('resource'); if (is_null($resourceFinder)) { die('Error: invalid finder'); } $resourceFinder->setType('image'); $audioResources = $resourceFinder->findAll(); if (is_null($audioResources) || !isset($audioResources)) { $audioResources = array(); } $this->render('resources', array('data' => $audioResources)); }
public function actionViewResourceObject($id, $type, $type_id) { $finder = FinderFactory::createFinderWithType('class'); $class = $finder->findById(intval($type_id)); $finder = FinderFactory::createFinderWithType('resource'); $finder->setType($type); $resource = $finder->findById(intval($id)); $finder = FinderFactory::createFinderWithType('object'); $objects = $finder->findAll(); $this->render('resourceview', array('type' => $type, 'class' => $class, 'resource' => $resource, 'objects' => $objects)); }