Commit 9b5e870a authored by Qiang Xue's avatar Qiang Xue

Added Component::__clone()

parent 8c268939
...@@ -207,6 +207,15 @@ class Component extends \yii\base\Object ...@@ -207,6 +207,15 @@ class Component extends \yii\base\Object
throw new BadMethodException('Calling unknown method: ' . get_class($this) . "::$name()"); throw new BadMethodException('Calling unknown method: ' . get_class($this) . "::$name()");
} }
/**
* This method is called after the object is created by cloning an existing one.
* It removes all behaviors because they are attached to the old object.
*/
public function __clone()
{
$this->_b = null;
}
/** /**
* Returns a list of behaviors that this component should behave as. * Returns a list of behaviors that this component should behave as.
* *
......
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