Hi All I am working through examples of containable and applying conditions to the results.
I have a basic blog example running, where Posts can have many comments. I'm trying to use contain with conditions so I can pick out only posts that have been commented on by a particular user. Here is my test function from my controller: function test() { $result = $this->Post->find('all',array('contain' => 'Comment.name = "Howard"')); debug($result); } I would expect the debug output in my view to only contain Posts which user Howard has commented on.. however here are the results I get: Array ( [0] => Array ( [Post] => Array ( [id] => 1 [name] => First post [date] => 2009-08-13 15:01:00 [content] => This is our first blog post, how exciting. [user_id] => 1 ) [Comment] => Array ( [0] => Array ( [id] => 1 [name] => Howard [content] => Lovely post, really lovely post. [post_id] => 1 ) ) ) [1] => Array ( [Post] => Array ( [id] => 2 [name] => Our second post [date] => 2009-08-14 10:11:00 [content] => Our second post [user_id] => 1 ) [Comment] => Array ( ) ) So as you can see it is still returning ALL posts yet only attaching comments if they were made by Howard. This isn't the behaviour I was expecting, as the example code shown at http://book.cakephp.org/view/474/Containable claims it should exclude all Posts without comments by the specified user. I am hoping someone can point me in the right direction here. Thanks c5 --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---