Eek that first line was supposed to read Hey all, I'm sorry IF
something like this already exists but I really had
no clue what to search for.
On Oct 12, 10:26 pm, JoshSchramm [EMAIL PROTECTED] wrote:
Hey all, I'm sorry something like this already exists but I really had
no clue what to search for.
I'm trying to set up a rather complex find. It works something like
this.
I have users, those users can have friends (think social networking
esque). Friends is simply a backrefrence to the users table. I.e. my
join table Friends_Users contains to fields (user_id, friend_id) both
of which point to the Users table.
Users can have Tips. Therefore Friends have tips.
Relationally
Users HABTM Friends.
Users HasMany Tips
Tips BelongsTo Users
I'm trying to do a find that returns all the tips owned by any friend
of the passed in user as well as any tips owned by the user itself.
The following SQL query works -
SELECT *
FROM `tips`
JOIN users ON users.id = tips.user_id
JOIN friends_users ON tips.user_id = friends_users.friend_id
WHERE (friends_users.user_id =2 or tips.user_id=2)
LIMIT 0 , 30
But i have no idea how to do that in cakephp world. I posted this on
stackoverflow here
-http://stackoverflow.com/questions/196488/complex-find-in-cake-php
- but havent heard much back yet.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---