Welcome Guest, Not a member yet? Register   Sign In
DataMapper ORM v1.8.2

[eluser]maikens[/eluser]
I'm not sure that will work for my situation. I have to be able to be able to separate the relationship between user_types and groups and then for each combination of user_type and group, I add as many resources as needed. So I tried making a model for groups_user_types_resources, with a resource_id and a groups_user_type_id, but I don't know how to use DM to access the join table.

If I do it with a join table with all three, won't that prevent me from separating the assigned user_types for each group from the assigned resources for that groups_user_types combination? Or are you suggesting that I use the table to either have a user_type_id and group_id (to represent the first combination), or all three (to represent a particular permission for a resource for that combination of user_type and group?

[eluser]Maglok[/eluser]
Ahh I see

Well you can make a DM object out of two and add a 'has many' to the third with a join table, effectively a join table on a join table.

If you want to know how to work with join fields I recommend reading this bit: http://datamapper.maglok.nl/pages/joinfields.html

[eluser]maikens[/eluser]
So in that case do I keep

groups_user_types

and also create a different model that is essentially the same but named differently so I can reference it in the has_many / has_one properties?

[eluser]maikens[/eluser]
Nevermind, I think I understand. I just need to create a model for 'groups_user_types', and define has one group and has one user_type. Those two models will now do has many groups_user_types instead of each other. it's essentially defining the join table as a model instead of it being only in the database.

Thanks for your help, Maglok.

[eluser]Maglok[/eluser]
Not a problem. Smile




Theme © iAndrew 2016 - Forum software by © MyBB