本文整理汇总了PHP中yii\base\Model::__set方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::__set方法的具体用法?PHP Model::__set怎么用?PHP Model::__set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Model
的用法示例。
在下文中一共展示了Model::__set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __set
public function __set($name, $value)
{
if (in_array($name, ['creditCard_number', 'creditCard_expirationDate', 'creditCard_cvv'])) {
$this->_attributes[$name] = $value;
}
return parent::__set($name, $value);
}
示例2: __set
/**
* Sets property or item.
*
* @param string $name item or property name
* @param string $value value to be set
*
* @return mixed item of found or the named property value
*/
public function __set($name, $value)
{
if ($name && $this->canSetProperty($name)) {
parent::__set($name, $value);
} else {
$this->setItem($name, $value);
}
}
示例3: __set
/**
* @brief 设置某个属性值 PHP magic function
*
* @return public function
* @retval
* @see
* @note
* @author 吕宝贵
* @date 2016/03/07 15:49:36
**/
public function __set($name, $value)
{
if ($this->hasAttribute($name)) {
$this->_attributes[$name] = $value;
} else {
parent::__set($name, $value);
}
}
示例4: __set
public function __set($name, $value)
{
if (stripos($name, 'attr') === 0) {
$this->attr[$name] = $value;
} else {
parent::__set($name, $value);
}
}
示例5: __set
public function __set($name, $value)
{
if (array_key_exists($name, array_flip($this->extraAttributes))) {
$this->extraAttributesData[$name] = $value;
} else {
parent::__set($name, $value);
}
}
示例6: __set
/**
* @param string $name
* @param mixed $value
*/
public function __set($name, $value)
{
$_name = explode('.', $name);
if (count($_name) == 2) {
$this->_attributes[$name] = $value;
} else {
parent::__set($name, $value);
}
}
示例7: __set
/**
* @inheritdoc
*/
public function __set($name, $value)
{
if (is_array($value)) {
$value = array_map('trim', $value);
} elseif (is_string($value)) {
$value = trim($value);
}
if (isset($this->attrStorage[$name])) {
$this->attrStorage[$name] = $value;
return true;
}
return parent::__set($name, $value);
}
示例8: __set
public function __set($name, $value)
{
if (isset($this->models[$name])) {
$this->models[$name] = $value;
return;
}
foreach ($this->models as $model) {
if ($model->hasAttribute($name)) {
$model->setAttribute($name, $value);
return;
}
}
parent::__set($name, $value);
}
示例9: __set
public function __set($propertyName, $propertyValue)
{
if ($this->canSetProperty($propertyName)) {
return parent::__set($propertyName, $propertyValue);
}
try {
return $this->item->{$propertyName} = $propertyValue;
} catch (\Exception $e) {
}
try {
$t = $this->item->data;
$t->{$propertyName} = $propertyValue;
return $this->item->data = $t;
} catch (\Exception $e) {
}
}
示例10: __set
/**
* @param string $name
* @param mixed $value
*/
public function __set($name, $value)
{
if (isset($this->attributes[$name])) {
$this->attributes[$name] = $value;
} else {
parent::__set($name, $value);
}
}
示例11: __set
public function __set($name, $value)
{
if (in_array($name, $this->getClientAttributes())) {
return $this->_entity->{$name} = $value;
}
return parent::__set($name, $value);
}
示例12: __set
/**
* @inheritdoc
*/
public function __set($name, $value)
{
if (array_key_exists($name, $this->_attributes)) {
$this->_attributes[$name] = $value;
} else {
parent::__set($name, $value);
}
}
示例13: __set
/**
* PHP setter magic method.
* This method is overridden so that AR attributes can be accessed like properties.
* @param string $name property name
* @param mixed $value property value
*/
public function __set($name, $value)
{
if (!$this->setAttributeInternal($name, $value)) {
parent::__set($name, $value);
}
}
示例14: __set
public function __set($name, $value)
{
if ($name == 'scenario') {
parent::__set($name, $value);
return;
}
if (property_exists(get_class($this), $name)) {
$this->{$name} = $value;
} else {
$this->dynAttributes[$name] = $value;
}
}
示例15: __set
public function __set($name, $value)
{
try {
parent::__set($name, $value);
} catch (UnknownPropertyException $e) {
if (isset($this->_attr[$name])) {
$this->_attr[$name] = $value;
}
}
}