/** * (non-PHPdoc) * @see t41\ObjectModel.ObjectModelAbstract::reduce() */ public function reduce(array $params = array(), $cache = true) { $data = array(); // populate only collections if params is set if (isset($params['collections']) && $params['collections'] > 0) { $params['collections']--; foreach ($this->getMembers() as $member) { // but prevent too-costly any deeper recursion $data[] = $member->reduce($params, $cache); } } return array_merge(parent::reduce($params), array('collection' => $data)); }
/** * (non-PHPdoc) * @see t41\ObjectModel.ObjectModelAbstract::reduce() */ public function reduce(array $params = array(), $cache = true) { $class = get_class($this); $type = str_replace('Property', '', substr($class, strrpos($class, '\\') + 1)); return array_merge(parent::reduce($params, $cache), array('value' => $this->getValue(), 'type' => $type, 'label' => $this->getLabel())); }
/** * (non-PHPdoc) * @see t41\ObjectModel.ObjectModelAbstract::reduce() */ public function reduce(array $params = array(), $cache = true) { //$uuid = ($this->_uri instanceof ObjectUri) ? $this->_uri->reduce($params) : null; $uuid = $cache ? Registry::set($this) : null; $props = array(); foreach ($this->_data as $key => $property) { if (isset($params['props']) && !in_array($key, $params['props'])) { continue; } $constraints = $property->getParameter('constraints'); // ignore stricly server-side properties if (isset($constraints['serverside'])) { continue; } $props[$key] = $property->reduce($params, $cache); } return array_merge(parent::reduce($params), array('uuid' => $uuid, 'props' => $props)); }