Monday, March 2, 2009

habtm scenario

Hello,

I have some problems createing relationships based on following 2
scenarios:

Scenario 1:

I have following tables: post , comment , user like this:

post : id, title
comment: id, user_id,post_id, comment
user:id, username

What model association should i use in order to have this:

querying the post to have : post title, comments with username (not
user id)


Scenario 2:

Also have following tables post, favorites, user with:
post : id, title
favorites: id, user_id, post_id
user:id, username

when querying post to have all favorites posts owned by current logged
user.


Please help.

Thank you in advance.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: