contributte / datagrid

:muscle: DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc
https://contributte.org/packages/contributte/datagrid/
MIT License
285 stars 189 forks source link

[DoctrineDataSource] Allow not to use Doctrine's Paginator #1071

Open jaroslavlibal opened 1 year ago

jaroslavlibal commented 1 year ago

In DoctrineDataSource the Paginator from Doctrine (Doctrine\ORM\Tools\Pagination\Paginator) is used for situations when JOIN or GROUP BY is used.

I assume this is because of the "to-many" relationships - we want the number of entries on the page match the selected number. In this case, however, Doctrine runs an additional SQL query to determine the number of results, which can take quite a long time on a large databases (DISTINCT, MIN, GROUP BY...).

This (if I am only using to-one relations) might not be necessary and I would like to be able to disable the use of the external Paginator from Doctrine.

Is that a legitimate request or am I missing something, please? My idea is e.g. new public method disableDoctrinePaginator() that stores this request in a private variable. This is then used in the existing private method usePaginator().