APYDataGridBundle icon indicating copy to clipboard operation
APYDataGridBundle copied to clipboard

Problem method getTotalCount with groupBy

Open xbegault opened this issue 11 years ago • 2 comments

Hello,

I use datagrid with entity/annotation and i realized that the method "getTotalCount()" don't return the right result.

For example : I have 50 rows in db, when i group them on the title, only 6 rows are displayed, but the method still return 50.

Why don't replace this part of :

//APY/DataGridBundle/Source/Entity.php
public function getTotalCount($maxResults = null)
{
    ...
    $data = $countQuery->getScalarResult();
    $data = array_map('current', $data);
    $count = array_sum($data);
}

by this ? :

//APY/DataGridBundle/Source/Entity.php
public function getTotalCount($maxResults = null)
{
    ...
    $data = $countQuery->getScalarResult();
    $count = count($data);
}

xbegault avatar Mar 06 '13 15:03 xbegault

You can't for some case, but your bug is related to the #364

Abhoryo avatar Mar 06 '13 15:03 Abhoryo

I saw, when the query has no "GROUP BY", but when has it, the result is wrong.

xbegault avatar Mar 07 '13 08:03 xbegault