Re: How to update a model with save method?

2008-11-18 Thread Sabir
Hey ORC can you explain how you have overridden the exists method. It would be good if you can paste a sample code. Thanks Sabir On Sep 23, 11:29 am, ORCC [EMAIL PROTECTED] wrote: Thanks for all your answers. I found my error: I've overridden the exists method in my model for other uses.

Re: How to update a model with save method?

2008-09-25 Thread forrestgump
ORCC can u elaborate on that? forrestgump On Sep 23, 10:29 pm, ORCC [EMAIL PROTECTED] wrote: Thanks for all your answers. I found my error: I've overridden the existsmethodin mymodelfor other uses. So, it seems that savemethodinvokes the existsmethodto decide wheter call an INSERT or

Re: How to update a model with save method?

2008-09-23 Thread [EMAIL PROTECTED]
I noticed something similar a few weeks ago, just out of the blue. I am not entirely sure what I did to fix it. It was either: -Going to the tried and tested first create(), then save($data). -Or my favorite enemy the cache needing to visit the trash-can. /Martin On Sep 23, 7:28 am, ORCC

Re: How to update a model with save method?

2008-09-23 Thread forrestgump
I had a similar problem ORCC...check if the table you are inserting your data into has the primary key properly set...it appears you are using TYPE INTmake sure that it is the primary and is on auto_increment u usuallyy get duplicate entry errors when its not on auto_increment...

Re: How to update a model with save method?

2008-09-23 Thread techiguy
just drop ur table and re create it with id as a primary key with an auto_increment. On Sep 23, 2:37 pm, forrestgump [EMAIL PROTECTED] wrote: I had a similar problem ORCC...check if the table you are inserting your data into has the primary key properly set...it appears you are using TYPE

Re: How to update a model with save method?

2008-09-23 Thread teknoid
Is your primary key field really named 'id' ... not 'ID' or something along those lines? That being said $this-Manufacturer-id = $id should work regardless of the primary key column name, since the $id property here simply refers to the key column and has nothing to do with the actual name. The

Re: How to update a model with save method?

2008-09-23 Thread ORCC
Thanks for all your answers. I found my error: I've overridden the exists method in my model for other uses. So, it seems that save method invokes the exists method to decide wheter call an INSERT or an UPDATE. I thought erroneuosly that save method only checked that the id attribute was set.

How to update a model with save method?

2008-09-22 Thread ORCC
In the blog tutorial, they use the save method both to save or update an existing record. I tried to take that idea for my application and had some trouble: My model is the following, with all default table names (i.e id is the primary key) class Manufacturer extends AppModel { var

Re: How to update a model with save method?

2008-09-22 Thread teknoid
$this-Manufacturer-id = $id; you can also save() the data without doing a set() first, i.e. $this- Manufacturer-save($this-data); the update would also get triggered if 'id' is part of the $this-data array On Sep 22, 11:25 pm, ORCC [EMAIL PROTECTED] wrote: In the blog tutorial, they use the

Re: How to update a model with save method?

2008-09-22 Thread ORCC
Thank you for answer. On 23 sep, 00:42, teknoid [EMAIL PROTECTED] wrote: $this-Manufacturer-id = $id; you can also save() the data without doing a set() first, i.e. $this- Manufacturer-save($this-data); This doesn't work either in my model-controller given in the previous posts. I can't