#5123: Incorrect find('count') results when using "GROUP BY" and
Controller::paginate()
------------------------------------------+---------------------------------
Reporter: bunyan | Owner:
Type: Enhancement | Status: reopened
Priority: Low | Milestone: 2.0.0.x
Component: MySQL | Version: Alpha
Severity: Normal | Resolution:
Keywords: paginate, count, group by | Php_version: PHP 5
Cake_version: 1.2.0.7296 RC2 |
------------------------------------------+---------------------------------
Comment (by nebbian):
If anyone else is having trouble with this BUG, then add the following
code to your model.
Many thanks to [http://wiltonsoftware.com/posts/view/custom-group-by-
pagination-and-a-calculated-field#c161 this post] for the solution.
{{{
function paginateCount($conditions = null, $recursive = 0, $extra =
array()) {
$parameters = compact('conditions');
$this->recursive = $recursive;
$count = $this->find('count', array_merge($parameters, $extra));
if (isset($extra['group'])) {
$count = $this->getAffectedRows();
}
return $count;
}
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/5123#comment:9>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---