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. On 23 sep, 11:08, teknoid <[EMAIL PROTECTED]> wrote: > 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 actual name is stored in the $primaryKey property of the model. > > On Sep 23, 1:28 am, ORCC <[EMAIL PROTECTED]> wrote: > > > 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 figure where is the mistake, but I've have tested the > > following: > > > - Set $this->Manufacturer->id = $id > > - Set $this->data['Manufacturer']['id'] = $id and invoke $this- > > > >Manufacturer->save($this->data) > > > With both alternatives, the mysql error of duplicate key appears and > > the query performed is an INSERT one. > > > Regards. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---