I also found that the group by value was correct for some paginate
calls and what I needed was the effected rows, I modified the
paginateCount method override as follows :-

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;
}

Hope this helps.

----
Brett Wilton
http://wiltonsoftware.com

On Tue, Dec 9, 2008 at 10:34 AM, Brett Wilton <[EMAIL PROTECTED]> wrote:
> You need to override the pageCount() method with a custom count query,
> for a similar type of query to yours I used the following method in my
> model...
>
> function paginateCount($conditions = null, $recursive = 0, $extra = array()) {
>        $parameters = compact('conditions');
>        $this->recursive = $recursive;
>        $count = $this->find('count', array_merge($parameters));
>        return $count;
> }
>
> Essentially this is the same as the default count method but I ignore
> the extra field which contains the group by clause i.e. $extra is not
> passed to the find().
>
> ----
> Brett Wilton
> http://wiltonsoftware.com
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to