Cake not putting quotes around field value when doing an UpdateAll
I am using UpdateAll in my Users controller as follows:
$this->User->MsgReceived->updateAll(
array(
'MsgReceived.from_user_id' => 'null',
'MsgReceived.sender' => $username
),
array('MsgReceived.from_user_id' => $user_id)
);
array(
'MsgReceived.from_user_id' => 'null',
'MsgReceived.sender' => $username
),
array('MsgReceived.from_user_id' => $user_id)
);
This causes an error because Cake is not putting quotes around the user name, even though sender is a character field:
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'josh' in 'field list'
SQL Query: UPDATE `epd`.`inemails` AS `MsgReceived` SET `MsgReceived`.`from_user_id` = null, `MsgReceived`.`sender` = josh WHERE `MsgReceived`.`from_user_id` = 46
Why is this?
Thanks.
-- 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home