[jifty-devel] Collection with group_by and count or pager->total_entries

Felix Abraham abraham at schaffhausen.de
Wed Jun 11 09:48:26 EDT 2008


Hi,

I'm using a Collection with group_by, and count or pager- 
 >total_entries don't return the values I would have expected. They  
return the number of results I would get without the group_by. This  
is the code:

my $children = MyApp::Model::ChildCollection->new();
$children->unlimit;
my $familyalias = $children->join(alias1 => 'main', column1 =>  
'family', table2 => MyApp::Model::Family->table, column2 => 'id');
$children->group_by(function => 'CONCAT('.$familyalias.'.id,  
main.lastname)');
$children->order_by(alias => 'main', column => 'lastname');
$children->set_page_info( current_page => $page, per_page => 10 );
warn $children->count;
warn $children->pager->total_entries;

Using $children->next I get the right number of results. Is there a  
way to make the pager use the group_by, too?

Thanks for your help,

Felix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jifty.org/pipermail/jifty-devel/attachments/20080611/c589089c/attachment.htm 


More information about the jifty-devel mailing list