__unset() public method

Magic unset method, allows unset($model->property)
public __unset ( string $property ) : void
$property string
return void
Example #1
0
 /**
  * Capture __unset() to make sure no read-only properties are erased
  *
  * @param   string  $property
  */
 public function __unset($property)
 {
     // make sure we're not unsetting a read-only value
     if (in_array($property, static::tree_config('read-only'))) {
         throw new \InvalidArgumentException('Property "' . $property . '" is read-only and can not be changed');
     }
     parent::__unset($property);
 }