Commit 0b265f0e by Alexander Makarov

A bit more friendly behavior for unsetting a model attribute

parent 66fcf622
...@@ -656,13 +656,13 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess ...@@ -656,13 +656,13 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
} }
/** /**
* Unsets the element at the specified offset. * Sets the element value at the specified offset to null.
* This method is required by the SPL interface `ArrayAccess`. * This method is required by the SPL interface `ArrayAccess`.
* It is implicitly called when you use something like `unset($model[$offset])`. * It is implicitly called when you use something like `unset($model[$offset])`.
* @param mixed $offset the offset to unset element * @param mixed $offset the offset to unset element
*/ */
public function offsetUnset($offset) public function offsetUnset($offset)
{ {
unset($this->$offset); $this->$offset = null;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment