Example #1
0
 public function readAction()
 {
     $collection = new Collection($this->_class);
     if ($this->_getParam('id')) {
         $collection->having(ObjectUri::IDENTIFIER)->equals($this->_getParam('id'));
         $collection->setBoundaryBatch(1)->find();
         if ($collection->getTotalMembers() == 1) {
             $form = new FormComponent($collection->getMember(Collection::POS_FIRST));
             $form->register();
         }
     } else {
         $list = new ListComponent($collection);
         $list->addRowAction($_SERVER['REQUEST_URI'], 'Read', array('icon' => 'tool-blue'));
         $list->register();
     }
 }
Example #2
0
 /**
  * returns a collection of objects matching the dependency parameter
  */
 public function dependAction()
 {
     if (($property = $this->_obj->getProperty($this->_post['destProperty']['id'])) !== false) {
         // @todo implement cache mechanism for the following collection
         $collection = new Collection($property->getParameter('instanceof'));
         foreach ($this->_post['srcProperty'] as $key => $val) {
             $collection->having($key)->equals($val);
         }
         $collection->setBoundaryBatch(50000);
         $collection->find(ObjectModel::MODEL);
         $data = array();
         foreach ($collection->getMembers() as $member) {
             $reduced = $member->reduce();
             $data[$member->getUri()->getIdentifier()] = $reduced;
             if ($property->getValue() && $property->getValue()->getIdentifier() == $member->getIdentifier()) {
                 $this->_data['value'] = $reduced['uuid'];
             }
         }
         $this->_data['total'] = $collection->getTotalMembers();
         $this->_data['collection'] = $data;
     } else {
         $this->_status = 'NOK';
     }
 }