PHP code example of adt / bulk-fetcher

1. Go to this page and download the library: Download adt/bulk-fetcher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adt / bulk-fetcher example snippets



$qb = $entityManager->createQueryBuilder('user');

try {
	$entityManager->beginTransaction();	
	
	$data = \ADT\BulkFetcher\Factory::create($qb, 100);
	$data->onBeforeFetch[] = function() use ($entityManager) {
		$entityManager->commit();
		$entityManager->clear();
		$entityManager->beginTransaction();
	};
	
	foreach ($data as $key => $row) {
		// code
	}
	
	$entityManager->commit();

} catch (\Exception $e) {
	$entityManager->rollback();
	throw $e;
}