Example #1
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';
     }
 }