Tuesday, June 17, 2014

Magic of UpdateAll

$this->loadModel('User');  $this->User->updateAll(array('stauts'=>'active'),array());

Above code equvivalent SQL query is generated like this

UPDATE User SET status='active' WHERE 0 = 1;

When I written updateAll in cakephp like below

$this->loadModel('User');  $this->User->updateAll(array('stauts'=>'active'));

This code equvivalent SQL query is generated like this

UPDATE User SET status='active';

Why this happen I don't know. If I do not understand my question let me know in comment. I explain in breif.


Check reference : http://stackoverflow.com/questions/24259110/magic-of-updateall?noredirect=1#comment37476920_24259110

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: