Commit bf73fe80 by Qiang Xue

Merge pull request #1703 from crtlib/patch-2

Removed redundant code in detachBehaviors()
parents 0766ddca ee81915a
...@@ -543,13 +543,10 @@ class Component extends Object ...@@ -543,13 +543,10 @@ class Component extends Object
public function detachBehaviors() public function detachBehaviors()
{ {
$this->ensureBehaviors(); $this->ensureBehaviors();
if ($this->_behaviors !== null) {
foreach ($this->_behaviors as $name => $behavior) { foreach ($this->_behaviors as $name => $behavior) {
$this->detachBehavior($name); $this->detachBehavior($name);
} }
} }
$this->_behaviors = [];
}
/** /**
* Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. * 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