Exemple #1
0
 public function reduce(array $params = array(), $cache = true)
 {
     if (!$this->_value) {
         return parent::reduce($params, $cache);
     } else {
         // @todo improve performances !!
         $uuid = Core\Registry::set($this->getValue(ObjectModel::DATA));
         if (isset($params['extprops']) && ($params['extprops'] === true || array_key_exists($this->_id, $params['extprops']))) {
             $value = $this->getValue(ObjectModel::DATA)->reduce(array('props' => $params['extprops'][$this->_id], 'extprops' => $params['extprops']), $cache);
         } else {
             $value = $this->getDisplayValue();
         }
         return array_merge(parent::reduce($params, $cache), array('value' => $value, 'uuid' => $uuid));
     }
 }
 public function reduce(array $params = array(), $cache = true)
 {
     if (isset($params['collections']) && $params['collections'] > 0) {
         $value = $this->getValue();
         $value = $value->reduce($params, $cache);
     }
     return array_merge(parent::reduce($params), array('value' => isset($value) ? $value['collection'] : $this->_value, 'type' => 'Collection'));
 }