Re: How to insert an empty string with CakePHP

2010-10-29 Thread euromark
i knew it^^ On 29 Okt., 13:58, Caroline wrote: > ok, I am an idiot... > After hours of debugging, I found the code where I, myself, unset the > field if it is empty. > Sorry about the waste of time and thanks for the help. > > On Oct 29, 9:05 pm, euromark wrote: > > > i still dont get why $objec

Re: How to insert an empty string with CakePHP

2010-10-29 Thread Caroline
ok, I am an idiot... After hours of debugging, I found the code where I, myself, unset the field if it is empty. Sorry about the waste of time and thanks for the help. On Oct 29, 9:05 pm, euromark wrote: > i still dont get why $object['Taxcode']['description'] = '' should be > ignored > in my cas

Re: How to insert an empty string with CakePHP

2010-10-29 Thread euromark
i still dont get why $object['Taxcode']['description'] = '' should be ignored in my case it always sets the field to empty in the database what you are doing is exactly what happens if you use edit and empty a field. sure there is no callback, no whitelisting involved? On 29 Okt., 04:27, Carolin

Re: How to insert an empty string with CakePHP

2010-10-28 Thread Caroline
Thanks for that, unfortunately, not luck with allowEmpty. I am going to report a bug and see what happens. On Oct 29, 11:40 am, cricket wrote: > On Thu, Oct 28, 2010 at 8:41 PM, Caroline wrote: > > sorry, not sure I follow. How? > > Because if the field is blank, Cake does not insert NULL, it ju

Re: How to insert an empty string with CakePHP

2010-10-28 Thread cricket
On Thu, Oct 28, 2010 at 8:41 PM, Caroline wrote: > sorry, not sure I follow. How? > Because if the field is blank, Cake does not insert NULL, it just > ignore the field. My bad. I forgot we were talking about an update. So, if the column was defined to be DEFAULT NULL, and the user deletes the de

Re: How to insert an empty string with CakePHP

2010-10-28 Thread Caroline
sorry, not sure I follow. How? Because if the field is blank, Cake does not insert NULL, it just ignore the field. I would have to explicitly write If ($data['Taxcode']['description']=='') $data['Taxcode'] ['description'] = null; before calling the save method. I know I can use beforeSave and other

Re: How to insert an empty string with CakePHP

2010-10-28 Thread cricket
On Thu, Oct 28, 2010 at 7:50 PM, Caroline wrote: > sorry I meant every time I need to update, like if description is > blank then insert null. Well, there you go--Cake does that for you ;-) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related que

Re: How to insert an empty string with CakePHP

2010-10-28 Thread Caroline
sorry I meant every time I need to update, like if description is blank then insert null. On Oct 29, 9:42 am, Caroline wrote: > Ok, fair enough, wrong example. Thanks for the tip, though. > In my previous post, please replace the code by this (same outputs): > >                 $object = array();

Re: How to insert an empty string with CakePHP

2010-10-28 Thread Caroline
Ok, fair enough, wrong example. Thanks for the tip, though. In my previous post, please replace the code by this (same outputs): $object = array(); $object['Taxcode']['id'] = '63ae4d63efeecf1655e9b948fdc114a8'; $object['Taxcode']['description'] = '';

Re: How to insert an empty string with CakePHP

2010-10-28 Thread cricket
On Thu, Oct 28, 2010 at 5:38 PM, Caroline wrote: > This is the code I run: >                $object = array(); >                $object['Taxcode']['id'] = '63ae4d63efeecf1655e9b948fdc114a8'; >                $object['Taxcode']['acctaxcollected_id'] = ''; >                $object['Taxcode']['acctax

Re: How to insert an empty string with CakePHP

2010-10-28 Thread Caroline
This is the code I run: $object = array(); $object['Taxcode']['id'] = '63ae4d63efeecf1655e9b948fdc114a8'; $object['Taxcode']['acctaxcollected_id'] = ''; $object['Taxcode']['acctaxpaid_id'] = ''; $this->Taxcode->save($ob

Re: How to insert an empty string with CakePHP

2010-10-28 Thread euromark
please post your sql debug output (the produced queries) On 28 Okt., 12:52, Caroline wrote: > Thanks for your replies. > Yes I might try to file it in trac, like you suggest, Cricket. > > Euromark, yes my field is varchar NOT NULL and I don't think I have a > bug because it is a pretty straight

Re: How to insert an empty string with CakePHP

2010-10-28 Thread Caroline
Thanks for your replies. Yes I might try to file it in trac, like you suggest, Cricket. Euromark, yes my field is varchar NOT NULL and I don't think I have a bug because it is a pretty straight forward operation. Only when the field is blank, it seems to be ignored. If you don't have the problem,

Re: How to insert an empty string with CakePHP

2010-10-28 Thread euromark
must be a bug on your side i can always empty my fields this way! is your field set to varchar(x) NOT NULL? On 28 Okt., 05:40, cricket wrote: > On Wed, Oct 27, 2010 at 8:00 PM, Caroline wrote: > > Hi, > > I am trying to update a field to an empty string in my DB. Sounds > > simple and I cannot f

Re: How to insert an empty string with CakePHP

2010-10-27 Thread cricket
On Wed, Oct 27, 2010 at 8:00 PM, Caroline wrote: > Hi, > I am trying to update a field to an empty string in my DB. Sounds > simple and I cannot find anybody else with the problem so I am > thinking I must be doing something really wrong... > > If I have a record in the DB with some value in 'desc

How to insert an empty string with CakePHP

2010-10-27 Thread Caroline
Hi, I am trying to update a field to an empty string in my DB. Sounds simple and I cannot find anybody else with the problem so I am thinking I must be doing something really wrong... If I have a record in the DB with some value in 'description', for example, and I do $data = array('id'=>1, 'name