doctrine/doctrine2 — pull request #576 by acasademont (2013-02-08 15:32:26+00:00)
Title: Update docs/en/reference/batch-processing.rst

If you have only $batchSize - 1 rows (amongst other cases), the entities are never flushed, you need a final flush outside the loop.

In the bulk insert you should also need a final flush if the number of entities inserted is not a multiple of the $batchSize.