Sunday, November 30, 2008

Re: update related model data

Did you try setting $this->User->UserProfile->id to the id of the
userprofile to be edited? (I'm not really sure about this since I've
never used "saveAll").

Maybe:

$userprofileid = $this->User->UserProfile->find(array('user_id' =>
$this->data['User']['id']),array('id'));
$this->User->UserProfile->id = $userprofileid['UserProfile']['id'];
$this->User->saveAll($this->data);

On Nov 30, 3:02 am, lacithetemplar <lacithetemp...@gmail.com> wrote:
> hello,
> I have two tables "users" and "user_profiles", which are related .
> there's no problem to add new data to this tables, but I don't know
> how to edit/update this data. when I use $this->User->saveAll($this->data), it updates users table, but in the user_profiles it add a new
>
> entry instead of update current entry. have someone a solution?
> thanks
--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: