Re: Why cake save to 0 value if you are editing a model ?

2007-05-28 Thread Derick Ng
When you submit a form, your data will contain empty values and when cake tries to insert these empty values into your columns which allow NULL, it will be 0 or -00-00 for dates. See: http://bakery.cakephp.org/articles/view/null-behavior#958 Slight updated to use $this->loadInfo() instead: ht

Re: Why cake save to 0 value if you are editing a model ?

2007-05-23 Thread ricarou51
So cake considers 0 as default value for an integer isn't it ? On 23 mai, 15:44, "Davide" <[EMAIL PROTECTED]> wrote: > Chris Hartjes wrote: > > Perhaps I'm wrong, but last I checked you can't set an integer to > > NULL...the default for an integer would be zero, wouldn't it? > > on MySQL 4.1.14-n

Re: Why cake save to 0 value if you are editing a model ?

2007-05-23 Thread Davide
Chris Hartjes wrote: > Perhaps I'm wrong, but last I checked you can't set an integer to > NULL...the default for an integer would be zero, wouldn't it? on MySQL 4.1.14-nt (Windows XP) CREATE TABLE `xyz` ( `field1` int(11) default NULL, `field2` int(11) default NULL ) ENGINE=MyISAM DEFAULT C

Re: Why cake save to 0 value if you are editing a model ?

2007-05-23 Thread Chris Hartjes
On 5/23/07, ricarou51 <[EMAIL PROTECTED]> wrote: > > Hello, > > I've this problem : > > for any table which contains 'int' fields ( I put default value at > NULL in the database) , when I add a row whitout filling the input for > my int field, there is no problem but when I edit a row , if the inp

Why cake save to 0 value if you are editing a model ?

2007-05-23 Thread ricarou51
Hello, I've this problem : for any table which contains 'int' fields ( I put default value at NULL in the database) , when I add a row whitout filling the input for my int field, there is no problem but when I edit a row , if the input for int field is empty, cake saves it to 0 and not to NULL .