Thanks again for your input. I been trying to get this right and for some reason either I am a complete idiot I just cant get it. Or If it is I do not think its right. I have been playing with it on the cakeapp site to build the tables to give people an idea. http://cakeapp.com/sqldesigners/sql/leiabeans
In my head User belongs to a group (either the INVESTOR or AGENT) Group hasMany Users ok that all makes sense no problems yet.... Now because the INVESTOR and AGENT profile information in completely different I want a table for each (INVESTORS and AGENTS), normally USER would have 1 profile but in this case there are 2 options of what profile a USER will have based on the GROUP they are in. User hasOne INVESTOR or AGENT (which is a profile) depending on the GROUP they belong to...this is where I am confusing myself. So a USER who belongs to the GROUP AGENT will have a AGENT USER.ID in the table...? Lost myself even trying to write it. Does this make sense to anyone? Thanks, Dave -----Original Message----- From: John Andersen [mailto:[email protected]] Sent: March-20-09 4:01 AM To: CakePHP Subject: Re: Dividing Users Yes, the GROUP (group_id) is the same as the ROLE when each user can only play one role (group)! So your user model should state that a user HasOne GROUP Your group model should state that a group HasMany USERs So when a user with group Seller is selling items with an ad, the ad must be related to the user, not the group! Your ad model should state that an ad HasOne SELLER. Your seller (user) model should state that a seller HasMany ADs The reason I am using a seller model, is that I then relieve the user model from taking care of the ad relationship, but it is up to you, how you like to model your tables. Hope this helps you on the way :) John, On Mar 19, 5:13 pm, "Dave Maharaj :: WidePixels.com" <[email protected]> wrote: > Thanks for your info. > > Just wondering because instead of ROLE I have group_id in the USER > table so each user is either a 1 2 or 3 (MANAGER, BUYER or SELLER) is > that not the same thing? > [snip] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
