How can I use cake's model object for me to be able to do this in a controller:
$User1->doThis();
$User2->doThis();
$User1 and $User2 are the clones of the User Model.
Are there any unforeseen consequences if I keep cloning model objects?
Are there better ways? I just find it a bit difficult to go back and forth to work with different entities on the same model object.
Thanks.
Probably not a good idea. I can't back this up with experiments, this is just my gut feeling. It just seems like a bad idea.
You do have to ask yourself: is this really something not solvable by other means? A simple for(each) loop? Custom methods in the model? Refactoring?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.