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,