Hi,

I want to paginate over posts which has some comments. That is, I want to 
get from the database only those posts which has al least one comments and, 
for each post, all the associated comments:

$post => array(
    [0] => array(
        Post,
        Comments => array(
            [0] => comment,
            ....
         )
   )
)

How can I do that?

I have got posts with some comments joining posts and commets tables, but I 
don't know how to get all comments for each post.

$this->paginate['joins'] = array(
                    'table' => 'comments',
                    'alias' => 'Comment',
                    'type' => 'RIGHT',
                    'conditions' => array('Comment.post_id  = Post.id');
                );
$this->paginate['group'] = array('Post.id');
$posts = $personas = $this->paginate(null);

Kind regards,

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to