Commit ee81915a by Paul Kofmann

Removed redundant code in detachBehaviors()

After ensureBehaviors() call $this->_behaviors is an array already. And since detachBehavior() unsets elements in $this->_behaviors, $this->_behaviors turns out to be an empty array after all iterations.
parent 369b9c27
......@@ -543,13 +543,10 @@ class Component extends Object
public function detachBehaviors()
{
$this->ensureBehaviors();
if ($this->_behaviors !== null) {
foreach ($this->_behaviors as $name => $behavior) {
$this->detachBehavior($name);
}
}
$this->_behaviors = [];
}
/**
* Makes sure that the behaviors declared in [[behaviors()]] are attached to this component.
......
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