Saturday, May 29, 2010

Re: HABTM Containable find('all') question

Do you have access to PhpMyAdmin or something to run queries direct on
your database?

If so try running this SQL

SELECT DISTINCT User.id, User.username FROM users AS User
LEFT JOIN admirers AS Admirer ON (User.id = Admirer.user_id AND
Admirer.approved IN(0,1))
LEFT JOIN friends AS Friend ON (User.id = Friend.user_id AND
Friend.approved IN(0,1))

Can you play with the above to see if you get the expected results and
report back to me?

The idea here is to work out how we would do it without Cake then
structure our Model::find to produce the same SQL.

HTH

Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: