Commit 3ca98d45 by resurtm

Merge branch 'master' of github.com:yiisoft/yii2

parents e9ad7d6e 8bb4a990
...@@ -496,6 +496,7 @@ class Component extends Object ...@@ -496,6 +496,7 @@ class Component extends Object
*/ */
public function detachBehavior($name) public function detachBehavior($name)
{ {
$this->ensureBehaviors();
if (isset($this->_behaviors[$name])) { if (isset($this->_behaviors[$name])) {
$behavior = $this->_behaviors[$name]; $behavior = $this->_behaviors[$name];
unset($this->_behaviors[$name]); unset($this->_behaviors[$name]);
...@@ -511,6 +512,7 @@ class Component extends Object ...@@ -511,6 +512,7 @@ class Component extends Object
*/ */
public function detachBehaviors() public function detachBehaviors()
{ {
$this->ensureBehaviors();
if ($this->_behaviors !== null) { if ($this->_behaviors !== null) {
foreach ($this->_behaviors as $name => $behavior) { foreach ($this->_behaviors as $name => $behavior) {
$this->detachBehavior($name); $this->detachBehavior($name);
......
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