/** * 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'; } }
public function find(array $conditions = null, array $sortings = null, $offset = 0, $batch = 10) { $co = new Collection(clone $this->_dataObject); if (is_array($conditions)) { $co->setConditions($conditions); } if (is_array($sortings)) { $co->setSortings($sortings); } $co->setBoundaryOffset($offset); $co->setBoundaryBatch($batch); $co->find(); return $co; }