Is it possible to over ride the paginateCount as described here
http://book.cakephp.org/view/249/Custom-Query-Pagination in the
controller? I have several actions in my controller, each of which
paginate the results. In one instance I have a
$this->paginate = array(
'recursive' => 2,
'joins' =>array(
array('table' => 'answers',
'alias' => 'answers',
'type' => 'LEFT',
'conditions' => array(
'question.id = answers.question_id',
),
)
),
'limit' => 2,
'order' => array(
'Question.created' => 'desc'
),
'group' => 'question.id HAVING COUNT(answers.id) = 0',
'fields' => '*, COUNT(answers.id) as answer_count'
);
Basically I have a question/answer site or think post/comments. When I
try to group using
'group' => 'post.id HAVING COUNT(comment.id) = 0', (I also added
having since I need to find all posts with no comments)
it messes up the group for the pagination count. So I need to override
the paginateCount method for just one action. The same model paginates
other actions so overriding paginateCount method in the controller
changes the pagination for all actions. Appreciate any help on this.
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 [email protected]
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