public function __call($method, $params) { //var_dump("Getting $method from a ".get_class($this)); if (! isset($this->_cache[$method]) || ! empty($params)) // always refetch when $params is not empty { if (MeshTools::IsNodeType($method)) { $cluster = new Cluster($this->_callChain); $cluster->_callChain->push($method, $params); if (empty($params)) // only cache when $params is empty { $this->_cache[$method] = $cluster; } return $cluster; } else { $this->_fetch(); // @todo: disable caching when $params is set } } if (! empty($params) && ! MeshTools::IsNodeType($method)) { throw new Exception('Parameters cannot be supplied for field of a node'); } return $this->_cache[$method]; }