Bit of a newbie question here - I'm trying to update multiple models at once, but the foreign key keeps getting lost. I'm using CakePHP version 1.1.12.4205.
I have User and Profile models. User hasOne Profile. When creating a new User and Profile it works fine, the associations are set up properly and when displaying the edit view the right data from both models is displayed. But then when saving the updates, the Profile['user_id'] field ends up without a value and the User loses their Profile. The view has hidden fields for User/id, Profile/id, and Profile/user_id. I've tried doing $this->User->setId($this->params['data']['User']['id']); $this->User->save($this->params['data']['User']); $this->User->Profile->setId($this->params['data']['Profile']['id']); $this->User->Profile->save($this->params['data']['Profile']); as well as $this->User->save($this->data); $user_id = $this->User->getLastInsertId(); $this->data['User']['Profile']['user_id'] = $user_id; $this->User->Profile->save($this->data); Both save the data correctly apart from the Profile['user_id'] field, which ends up blank. I've had a look round and I can't find this problem mentioned anywhere else. I know it's probably really obvious, but can someone please point out what I'm doing wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---