Hi, in your case try setting $this->data['Group']['Group'] = (array of ids), before save. That should work, there is an explanation about how to save related model data (HABTM) in the cake cookbook. (http://book.cakephp.org)
cheers On 1. Júl, 11:15 h., lysd <[EMAIL PROTECTED]> wrote: > Hi > > This has probably been asked before, but I couldn't find any docs or > posting on how to save multiple associations in a HABTM setup. > > I have Groups HABTM Users. > > When I create a new user, I want to be able to associate multiple > groups with this new user, but I can't seem to get it. > > The association is created properly if I assign 1 group with 1 user... > > $this->data['User']['id'] = 11; > $this->data['User']['username'] = 'beth'; > $this->data['User']['password'] = $this->Auth->password('beth'); > $this->data['Group']['id'] = 3; > $this->User->save($this->data); > > The corresponding record will appear properly in groups_users table. > But what about multiple groups? I've tried > > $this->data['Group']['id'] = array(2,3) to associate with groups 2 and > 3, but it didn't work. > > any help please > > thanks > > L. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---