On Mar 4, 6:52 pm, Omi <omi.chowdh...@gmail.com> wrote: > The correct way is to set > $this->data['Tag'][0] = array( > 'tag_id' => $foo, > 'tagger_id' => $bar > );
This is kinda on the right track. Here's an example of what I used for a Movies sample project: views/movies/add.ctp: <?php echo $form->create('Movie'); echo $form->input('Movie.name'); echo $form->input('MoviesUser.0.user_id'); echo $form->input('MoviesUser.0.ranking'); echo $form->end('Submit'); ?> controllers/movies_controller.ctp: function add() { if (!empty($this->data)) { $this->Movie->create(); $this->Movie->bindModel(array('hasMany'=>array('MoviesUser')), false); if ($this->Movie->saveAll($this->data)) { $this->Session->setFlash(__('The Movie has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Movie could not be saved. Please, try again.', true)); } } $users = $this->Movie->User->find('list'); $this->set(compact('users')); } IIRC the key was to do a bindModel with the name of the join relation name as a hasMany association before saving. Hope that helps some. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---