public function __unset($prop) { if (property_exists($this, $prop)) { if (isset($this->{$prop})) { $this->{$prop} = null; } } throw new BadMethodCallException(sprintf('Property "%s" does not exist for the class "%s".', $prop, get_class($this))); }