phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.76k stars 1.96k forks source link

[BUG]: Paginator Model Adapter Incorrect total items when grouped #16042

Closed ALameLlama closed 1 year ago

ALameLlama commented 1 year ago

Describe the bug This is currently always returning 1 for total items when grouped which also breaks the last page/total page count as well.

To Reproduce Steps to reproduce the behavior: Create a model paginator without passing a group in the parameters and then one with group.

    $paginator = new \Phalcon\Paginator\Adapter\Model([
        'model' => Model::class,
        'parameters' => [
            'type IN ({type:array})',
            'bind' => [
                'type' => [
                    Model::TYPE_1,
                    Model::TYPE_2,
                ],
            ],
            'group' => 'type'
        ]
    ]);

Since this is grouped by type and 2 types are provided, you'd expect it to return total items as 2 but this will return 1

Details

niden commented 1 year ago

Resolved in https://github.com/phalcon/cphalcon/pull/16043/