To do HABTM, you need an extra table. To do HABTM between users and game_pieces, you'd need a table called game_pieces_users (table1_table2 in alphabetical order). game_pieces_users would have 2 fields: game_piece_id and user_id.
I hope that helps a little. I've found that scaffolding helps me get a better idea of how my associations work. Turn scaffolding on, set some associations, and then see what info shows up in my view. It's a quick, easy way to get visuals on your associations. hydra12 On Nov 13, 8:59 pm, "Christoph" <[EMAIL PROTECTED]> wrote: > I have the following tables: > > users > collections, FK user_id, FK game_piece_id > game_pieces, FK games_set_id > games_sets, FK game_id, FK set_id > games > sets > > So, if I understand correctly: > > users $hasMany collections > collections $belongsTo users, game_pieces > game_pieces $belongsTo game_sets > games_sets $belongsTo games, sets > games $hasMany games_sets > sets $hasMany games_sets > > I would think that collections $hasMany game_pieces (such that many > game pieces make up a collection), but using the relationship between > users and collections as, well, a model, that means since collections > belongs to users, it must also belong to game_pieces. > > I suppose collections is a HABTM joining table between users and > game_pieces? But if I try to define the association that way, I get an > error from cake (using the debug mode 3) showing: > > 1146: Table 'cake_communal_haven.collections_users' doesn't exist > 1146: Table 'cake_communal_haven.collections_game_pieces' doesn't exist > > so obviously I can't make it a HABTM association. So I'm just not > quite getting this... > > Any help would be greatly appreciated! > > thnx, > Christoph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
