Re: Editing ID
If you want to update ID of record you must use saveField() or
updateAll() method.
Cake checks if record exists to determine if INSERT of UPDATE query is
needed for save() or saveAll() call. New ID in data takes precedence
over ID you set directly. So Cake don't find record with new ID and
assumes that you need INSERT.
On May 27, 10:25 am, thom <cyber.phanto...@gmail.com> wrote:
> Hello,,
>
> I am trying to edit the ID of a record. But what I got is cake make a
> new record (add/ insert not updating the record). How could I add
> 'WHERE' clause in save()?
> I've added were
>
> $this->Poscheck->id = $this->data['Poscheck']['old_id'];
> $save = $this->Poscheck->save($this->data);
>
> But it didn't work. Was I wrong? And is there any way to update the id
> instead of using query?
>
> Thank you in advance.
>
> --
> Regards,,,
> mastanto (thom_)http://mynameisthom.tumblr.comhttp://mynameisthom.blogspot.comhttp://www.twitter.com/mastanto_
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home