Doctrine 2.1 brings a new feature EXTRA_LAZY loading for associations: https://www.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/extra-lazy-associations.html
This feature creates a new method slice($offset, $length)
to query just a page of the association and is very useful for pagination of large data sets.
However, behind the scene the SQL query uses the classic LIMIT XX OFFSET XX
syntax which is slow for large data sets (https://www.eversql.com/faster-pagination-in-mysql-why-order-by-with-limit-and-offset-is-slow/)
Is there a way to use the pagination with a WHERE
clause?
If not, how may I extend the instance of Doctrine\ORM\PersistentCollection
to create a method sliceWithCursor($columnName, $cursor, $length)
?
My main goal is to implement a faster pagination while using the very convenient magic of Doctrine for associations.
Thanks !