Esempio n. 1
0
 /**
  * Perform get/set/add calls.
  * If the requested Field is not owned by this model it tunnels get/set/add methods to the linked model.
  *
  * @param  mixed $name      The name of the called method.
  * @param  array $arguments The arguments passed in the method call.
  * @return mixed
  */
 public function __call($name, array $arguments)
 {
     $fieldname = substr($name, 3);
     // use own __call method if field is appended to the link model
     if (true === isset($this->_fields[$fieldname])) {
         return parent::__call($name, $arguments);
     } else {
         if (array_key_exists(0, $arguments) === true) {
             return $this->_model->{$name}($arguments[0]);
         } else {
             return $this->_model->{$name}();
         }
     }
 }