__unset() 공개 메소드

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).
또한 보기: http://php.net/manual/en/function.unset.php
public __unset ( string $name )
$name string the property name
예제 #1
0
 /**
  * @inheritdoc
  */
 public function __unset($name)
 {
     if (property_exists($this->obj, $name)) {
         $this->obj->{$name} = null;
         return;
     }
     parent::__unset($name);
 }
예제 #2
0
 /**
  * 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);
     }
 }