public function __set($name, $value) { if ($this->hasState($name)) { $this->setState($name, $value); } else { parent::__set($name, $value); } }
/** * Magic set method. If a set<Name> method exists, then it is called. * Otherwise, pass to the parent * * @param string $name * @param mixed $value */ public function __set($name, $value) { $name = str_replace('_', '', $name); parent::__set($name, $value); }
/** * Sets value of a component property. * Do not call this method. This is a PHP magic method that we override * to allow using the following syntax to set a property * <pre> * $this->propertyName=$value; * </pre> * @param string $name the property name * @param mixed $value the property value * @return mixed * @throws CException if the property is not defined or the property is read only. * @see __get */ public function __set($name, $value) { $setter = 'set' . $name; if (property_exists($this->getClient(), $name)) { return $this->getClient()->{$name} = $value; } elseif (method_exists($this->getClient(), $setter)) { return $this->getClient()->{$setter}($value); } return parent::__set($name, $value); }
/** * @param string $strName * @param mixed $mixValue * @return mixed */ public function __set($strName, $mixValue) { switch ($strName) { case 'cartItems': return $this->model->cartItems; default: // As a clever trick to get to our model through the component, if ($strName != "model" && $this->model->hasAttribute($strName)) { $this->model->__set($strName, $mixValue); } else { return parent::__set($strName, $mixValue); } } }