On Jul 7, 10:31 pm, Robert P <[email protected]> wrote:
> If you have set up both the Member and County models with
> $hasAndBelongsToMany, you should be able to do away with your joining
> model CountiesMembers (using the table "counties_members" I'm
> presuming). Since you are going through and saving Counties to the
> Members, try something roughly like this:
>
>     $counties = array();
>     foreach ($counties as $county) {
>         $counties[] = $county['County']['id'];
>     }
>     // $this->Member->id must be set
>     $this->Member->save(array('County' => array('County' =>
> $counties)));
>
> Don't ask me why it's like that, but it is. So HABTM in both models,
> and a double-nested array of IDs will save the associations. Keep in
> mind that this will first destroy all the entries for that particular
> member then insert the new ones.

Hi Robert,

Perfect, worked a treat!

Many many thanks!

Alastair
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to