本文整理汇总了PHP中yii\base\Model::__unset方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::__unset方法的具体用法?PHP Model::__unset怎么用?PHP Model::__unset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Model
的用法示例。
在下文中一共展示了Model::__unset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __unset
/**
* Unsets property or item.
*
* @param string $name the property name or the event name
*/
public function __unset($name)
{
if ($name && $this->canSetProperty($name)) {
parent::__unset($name);
} else {
$this->unsetItem($name);
}
}
示例2: __unset
/**
* Sets a component property to be null.
* This method overrides the parent implementation by clearing
* the specified attribute value.
* @param string $name the property name or the event name
*/
public function __unset($name)
{
if ($this->hasAttribute($name)) {
unset($this->_attributes[$name]);
} elseif (array_key_exists($name, $this->_related)) {
unset($this->_related[$name]);
} elseif ($this->getRelation($name, false) === null) {
parent::__unset($name);
}
}
示例3: __unset
/**
* @inheritdoc
*/
public function __unset($name)
{
if (array_key_exists($name, $this->_attributes)) {
unset($this->_attributes[$name]);
} else {
parent::__unset($name);
}
}
示例4: __unset
/**
* Sets a component property to be null.
* This method overrides the parent implementation by clearing
* the specified attribute value.
* @param string $name the property name or the event name
*/
public function __unset($name)
{
if (!$this->setAttributeInternal($name, null)) {
if (array_key_exists($name, $this->_related)) {
unset($this->_related[$name]);
} elseif ($this->getRelation($name, false) === null) {
parent::__unset($name);
}
}
}
示例5: __unset
/**
* Sets a component property to be null.
* This method overrides the parent implementation by clearing
* the specified attribute value.
* @param string $name the property name or the event name
*/
public function __unset($name)
{
if ($this->hasAttribute($name)) {
unset($this->_attributes[$name]);
} else {
if (isset($this->_related[$name])) {
unset($this->_related[$name]);
} else {
parent::__unset($name);
}
}
}
示例6: __unset
/**
* Sets a component property to be null.
* This method overrides the parent implementation by clearing
* the specified attribute value.
* @param string $name the property name or the event name
*/
public function __unset($name)
{
if ($this->hasAttribute($name)) {
unset($this->_attributes[$name]);
} elseif ($this->getRelation($name, false) === null) {
parent::__unset($name);
}
}