public function __call($method, $arguments) { if ('resourceIds' === $method) { if (!count($arguments) && !is_array($this->resourceIds)) { return array(); } } return parent::__call($method, $arguments); }
/** * Magic method which allows getting and setting protected attributes * * @param $method * @param $arguments * * @return $this|array */ public function __call($method, $arguments) { if ('terms' === $method) { // If terms are not set (or are not array) - default it to an empty array if (!count($arguments) && !is_array($this->terms)) { return array(); } } return parent::__call($method, $arguments); }