New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CActiveRecord cloning #598
Comments
Actually Yii does not support cloning for its classes. This may cause a lot of troubles, and CActiveRecord is only the top of the iceberg. "CComponent" class introduces a "behavior" feature, however it does not provide the method "__clone". So if you have attached a behavior to some "CComponent" instance and then has cloned this instance the 2 component objects will share the same behavior object. Allowing Yii "CComponent" and its child classes to be cloned is a big deal. I am not sure how this can be done properly. |
Will not be supported in 1.1. |
Seems to be supported in Yii2: https://github.com/yiisoft/yii2/blob/master/framework/base/Component.php#L211 |
Yes, it is implemented in Yii2. |
Yii does not support cloning at the moment.
It could be useful.
Consider the following scenario:
Where ->byMonth() and ->byShop() are scopes defined like this:
This happens because $this->_c in the model points to the same object.
I know that I can workaround this. Just thought that having this feature in the box would be nice.
The text was updated successfully, but these errors were encountered: