You need an additional information - who is friend with whom - so a
new table "users_users" is born :)

So your relationships will be:
"users" hasMany "posts"
"users" hasAndBelongsToMany "users" through "users_users".

And you have to find:
1) The current users post using "users" hasMany "posts" association.
2) The current users friends posts using both associations "users"
hasAndBelongsToMany "users" (friends) hasMany "posts"

For 2) you have to lookup recursive and unbindModel/bindModel.

Enjoy,
  John

On Apr 20, 2:34 am, Victorr <[email protected]> wrote:
> I need some help with linking my database tables and models.
>
> I have:
> User
> Profile
> Post
>
> A User has many posts, one profile and many friends(other users). I
> want to display the users posts and the users friends posts on the
> profile.
>
> How should i build the database(like friendship between users) and the
> model associations?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to