I have had this issue and in 1.2 got round it by changing my model bindings on the fly. However if you can upgrade to 1.3 you can have that calculated field defined as a virtual field which will make sorting by it much easier to do.
On May 21, 4:12 pm, Filipe <filipe.t2...@gmail.com> wrote: > I'm using the version 1.2. When I try to order the pagination by a > field that is not in any table, for example, "SUM(Model.field) AS > new_field", the pagination isn't ordered by this new_field. It happens > because in the file cake/libs/controller/controller.php, line 1017, > the expression $object->{$alias}->hasField($field) is false in that > case. We have changed this file, at the line 1021: > > }else{ //line 1021 > foreach ($this->paginate[$alias]["fields"] as > $columnName){ > if(preg_match("/\b$field\b$/", $columnName)){ > $options['order'][$field] = $value; > break; > } > } > } > > Perhaps there are better solutions for this problem. I hope you > understand my english. Thank you. > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > athttp://groups.google.com/group/cake-php?hl=en 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en