Every once in a while you run into a situation where you need to load a lot (think thousands, not hundreds) of Doctrine entities from the database.
For example when you want to create an export file, or when you want to apply some logic to all of them.
The problem when you try this using the default implementation of Doctrine
EntityRepository::findAll() is that it will load all entities
from the database at once, oftentimes causing an out of memory error.
There is a relatively easy solution to this, using a