Re: Prevent Cake 1.2 from auto inserting 0000-00-00 00:00:00 in datetime field

2007-11-08 Thread RLR
I found out why this is happening. Mysql seems to be responsible for this and not cake. sorry. Anyway the solution is to set the recurring_date = NULL in beforeSave as mentioned by sensor. My code was setting recurring_date = "" Now it works. --~--~-~--~~~---~--~---

Re: Prevent Cake 1.2 from auto inserting 0000-00-00 00:00:00 in datetime field

2007-11-08 Thread RLR
Thanks for your suggestions. I double checked everything (db structure) and cake still behaves this way for me :( Even when I use beforeSave to replace "-00-00 00:00:00" with null the database row ends up the same. I also tried using a different table that is scaffolded. Could it be the form

Re: Prevent Cake 1.2 from auto inserting 0000-00-00 00:00:00 in datetime field

2007-11-08 Thread senser
I have solved this in beforeSave() callback where I check if field is not obligatory and is empty I set to NULL On Nov 8, 8:03 pm, RLR <[EMAIL PROTECTED]> wrote: > Cake 1.2 keeps auto inserting -00-00 00:00:00 into my datetime > field even though the table field is defined as: > > `recurring_

Re: Prevent Cake 1.2 from auto inserting 0000-00-00 00:00:00 in datetime field

2007-11-08 Thread lemp
Cake won't affect date field other than modified and created, but MySQL can if not set up properly. Depending on the tool you use, you can have some surprise. I use Navicat and IT automatically insert a default value when I create a datetime field, even if I set it to accept null value. On Nov 8,

Re: Prevent Cake 1.2 from auto inserting 0000-00-00 00:00:00 in datetime field

2007-11-08 Thread francky06l
@lemp Even when the field name is "recurring_date" ? On Nov 8, 9:17 pm, lemp <[EMAIL PROTECTED]> wrote: > Make sure your date field is set to allow NULL value and that the > default is NULL. Don't trust your creation script: check the actual > value. > > Cake will auto-insert the date on "created

Re: Prevent Cake 1.2 from auto inserting 0000-00-00 00:00:00 in datetime field

2007-11-08 Thread lemp
Make sure your date field is set to allow NULL value and that the default is NULL. Don't trust your creation script: check the actual value. Cake will auto-insert the date on "created" and "modified" unless there is a default already defined in the DB. --~--~-~--~~~-

Prevent Cake 1.2 from auto inserting 0000-00-00 00:00:00 in datetime field

2007-11-08 Thread RLR
Cake 1.2 keeps auto inserting -00-00 00:00:00 into my datetime field even though the table field is defined as: `recurring_date` datetime default NULL, When I save the form I see in the sql debug query that the value from recurring_date is set to ''. In the db it is still being saved as '000