Symfony Tip: Propel pager with group-by returns incorrect total

A quick tip for those getting incorrect record totals (and thus broken paging) when using the propel pager in Symfony:

Add the following method to your pager object:

$pager->setPeerCountMethod('getGroupedCount');

Then create the following method in your peer class:

    public static function getGroupedCount($c)
    {
        $copy = clone $c;
        // this should be the intended grouping column
        $copy->addGroupByColumn(parent::ID);
        return parent::doCount($copy);
    }

Your pager will now work the way you want it to!