For those struggling with the same problem, I've found a solution. The array should be formatted as in the last comment on this page:
http://teknoid.wordpress.com/2009/03/30/revisiting-saveall-and-habtm/ Also note that you need saveAll(), not just save() ... it would seem. --Carl On Nov 8, 8:53 pm, carl67lp <[email protected]> wrote: > Apologies if this has been answered elsewhere; a reasonably thorough > search of this group and of the CakePHP docs yielded no useful > results. > > I've got an app that categorizes board games; it pulls data via XML > feed from an external site. My models are such that Game is the > "master" model, and it goes thusly: > > Game HABTM Artist > Game HABTM Category > Game HABTM Designer > > ...and so on. > > For a particular game, there can exist multiple artists, multiple > categories, and so on. For example, the game "Die Macher" has only > one designer, but three publishers and several categories. > > I'm able to put the artist/category/designer data into the appropriate > tables as needed. What I can't seem to figure out is how to properly > construct my $this->data array so that I can save the artists_games > HABTM linkages. > > Am I close with something like this? > > $this->data['Game'] = array > ( > 'Artist' => array('Artist.id' => $artist_id, 'Game.id' => $game_id), > 'Category' => array('Category.id' => $category_id, 'Game.id' => > $game_id), > ... > ); > > The documentation has everything coming in from a form; my app has > everything coming in from XML--thus, I need to manually create $this- > > >data. > > Incidentally: my baked view for /game/add/ have what look like multi- > select boxes for Artist/Category/etc., but no data inside. Did I miss > something somewhere? > > Many thanks for any assistance you can provide. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
