本文整理汇总了PHP中CApplicationComponent::__set方法的典型用法代码示例。如果您正苦于以下问题:PHP CApplicationComponent::__set方法的具体用法?PHP CApplicationComponent::__set怎么用?PHP CApplicationComponent::__set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApplicationComponent
的用法示例。
在下文中一共展示了CApplicationComponent::__set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __set
public function __set($name, $value)
{
if ($this->hasState($name)) {
$this->setState($name, $value);
} else {
parent::__set($name, $value);
}
}
示例2: __set
/**
* 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);
}
示例3: __set
/**
* 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);
}
示例4: __set
/**
* @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);
}
}
}