Total Complexity | 7 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class DoctrineBatchHelper implements DoctrineBatchHelperInterface |
||
14 | { |
||
15 | private EntityManagerInterface $em; |
||
16 | |||
17 | public function __construct(EntityManagerInterface $em) |
||
18 | { |
||
19 | $this->em = $em; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @throws Throwable |
||
24 | */ |
||
25 | public function wrapIterable(iterable $resultSet, int $batchSize): iterable |
||
45 | } |
||
46 | |||
47 | private function flushAndClearBatch(int $iteration, int $batchSize): void |
||
48 | { |
||
49 | if ($iteration % $batchSize) { |
||
50 | return; |
||
51 | } |
||
52 | |||
53 | $this->flushAndClearEntityManager(); |
||
54 | } |
||
55 | |||
56 | private function flushAndClearEntityManager(): void |
||
60 | } |
||
61 | } |
||
62 |