From 9b5e870a2db73895820749ce9d83250af98012ee Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 10 Aug 2012 08:43:54 -0400 Subject: [PATCH] Added Component::__clone() --- framework/base/Component.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/framework/base/Component.php b/framework/base/Component.php index fb9657a..f3f2f73 100644 --- a/framework/base/Component.php +++ b/framework/base/Component.php @@ -208,6 +208,15 @@ class Component extends \yii\base\Object } /** + * 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. * * Child classes may override this method to specify the behaviors they want to behave as.