[Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
[quote author="ennis" date="1256223999"]I have a users table, and a clients table I already have users have many clients and clients has many users and it works perfectly. Then I have a new realtions table to tell me witch users are admins for witch clients, called clients_admins how would I relate the client to this table? and user the other way? as they both have many[/quote] OK, I'm gonna try to wrap my head around this. I think you mean that you have Many Users to Many Clients already. You now want to add the ability to have Many Admins to Many Clients, where Admins are just a special case for Users. If this is correct, then I recommend looking at join fields. They are the easiest solution, because you can just make note of which Users are Admins by adding a boolean to the join table. You won't need the extra admins_clients table at all. Say you add a column called "isadmin" to your "clients_users" table. You use it like this: Code: $client = ...; If you only need one admin per client, then you can either use the join field, or you can add an additional relationship (but it may be more difficult to manage). |
Welcome Guest, Not a member yet? Register Sign In |