Hi Dave,
Looking at your model, I understand your problem.
As I understand it from your description:
1) A user can have one profile;
2) A user belongs to one group;
3) A user can create one or more ads;
4) A user can create one or more bookmarks;
5) A bookmark refers to one ad;
6) An ad may be referred to by one or more bookmark.
Text version of my data model ( A <-- B means B belongsTo A and A
hasMany B; no indication of mandatory relationships ):
groups <-- users <-- profiles <-- profile_attributes
users <-- ads <-- bookmarks
users <-- bookmarks
profile_types <-- profiles
attribute_types <-- profile_attributes.
The major changes from your model are:
1) The ads belongs to a user, not to a profile.
2) The bookmark belongs to a user, not to a profile.
3) One table (profiles) for all profiles, at least the information
that are common for all profiles.
4) Two tables (attribute_types and profile_attributes) for the profile
information, that are not common for all profiles.
So when you model this i CakePHP, and you read a users profile (Agent)
then the model should automatically also read all the profile
attributes (using HasMany relationship) from that model, thus ensuring
the correct information is available for your presentation of the
profile (Agent). And the same when you read a users profile
(Investor).
Did this help you?
Best wishes,
John
On Mar 20, 5:56 pm, "Dave Maharaj :: WidePixels.com"
<[email protected]> wrote:
> 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
[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
-~----------~----~----~----~------~----~------~--~---