I found out that for empty integer fields (that are optional of
course) Cake tries to save an empty string instead of NULL. I have to
handle this in Model::beforeSave() like:
if ($this-data[$this-name]['number'] === '') unset($this-data[$this-
name]['number']);
And so the empty string becomes NULL in the SQL statement.
On febr. 20, 16:06, Chris Hartjes [EMAIL PROTECTED] wrote:
On Feb 20, 2008 9:31 AM, Károly Kiripolszky
[EMAIL PROTECTED] wrote:
Dear Cake People,
I cannot debug one of my models. Model::save() always returns False,
although when I print out $this-data all fields are set properly and
Model::invalidFields() returns an empty array too.
I'm using the latest Cake from the repo, I use no validation rules or
behaviours. I don't get why the data cannot be saved.
Is there a way to get the query string generated by Cake for insertion?
Try pasting your code tohttp://bin.cakephp.orgso that people can see
what you're trying to do. Is it only the one model that is causing a
problem?
--
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---