Hi all.

Help me how to define the association between these:
1). User has many messages
2). User has many relations

If only those, it's simply just add the User model the hasMany variable
and in Message model and Relation model just add the belongsTo
variable. But I've been thinking to make such association into three
tables like this (this the only solution came up into my mind):
1). users: (PK)user_id + email + password + first_name + last_name
2). relations: (PK)relation_id + (FK to users)user_id + (FK to
users)friend_id
3). messages: (PK)message_id + (FK to users)user_id + (FK to
users)sender_id + subject + content + is_new + received_date

The relations table and messages table, both have two foreign keys
which are pointing to same users table. According to this condition, is
it okay if I define in User model, double hasMany variable and in the
other model, double belongsTo variable?

Do my approach correct? Any suggestions please... thanks.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to