/** * Helps to cache method results * @see fActiveRecord::__call() */ public function __call($methodName, $params) { // Call method only once if (strrpos($methodName, 'Once') !== false) { $methodName = str_replace('Once', '', $methodName); if (!isset($this->methodCallCache[$methodName])) { $this->methodCallCache[$methodName] = method_exists($this, $methodName) ? $this->{$methodName}($params) : parent::__call($methodName, $params); } return $this->methodCallCache[$methodName]; } return parent::__call($methodName, $params); }