kalibora / chunk-generator
Chunk generator (For keep memory usage low)
Installs: 51 477
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ^8.1
- doctrine/orm: ^2.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v3.16
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.5
README
Chunk generator (For keep memory usage low)
Installation
composer require kalibora/chunk-generator
Usage
For doctrine
use Kalibora\ChunkGenerator\ChunkGeneratorBuilder; $fooRepository = $manager->getRepository(Foo::class); $qb = $fooRepository->createQueryBuilder('f'); $gen = ChunkGeneratorBuilder::fromDoctrineQueryBuilder($qb)->setChunkSize(200)->build(); // Iterate all foo entity. Fetch 200 records at a time and clear it. foreach ($gen() as $foo) { echo $foo->getVar(), PHP_EOL; }