This method will check in the following order and act accordingly:
- a property defined by a setter: set the property value to be null
- a property of a behavior: set the property value to be null
Do not call this method directly as it is a PHP magic method that
will be implicitly called when executing unset($component->property).
/** * @inheritdoc */ public function __unset($name) { if (property_exists($this->obj, $name)) { $this->obj->{$name} = null; return; } parent::__unset($name); }
/** * Sets a component property to be null. * Do not call this method. This is a PHP magic method that we override * to allow using unset() to set a component property to be null. * @param string $name the property name or the event name * @throws \yii\base\InvalidCallException if the property is read only. * @return mixed */ public function __unset($name) { $setter = 'set' . $name; if (property_exists($this->getClient(), $name)) { $this->getClient()->{$name} = null; } elseif (method_exists($this, $setter)) { $this->{$setter}(null); } else { parent::__unset($name); } }