Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3.0884 |
Changes | 0 |
1 | <?php |
||
29 | 16 | public function getIterator(): \Traversable |
|
30 | { |
||
31 | 16 | $logger = $this->em->getConfiguration()->getSQLLogger(); |
|
32 | 16 | $this->em->getConfiguration()->setSQLLogger(null); |
|
33 | 16 | $this->em->beginTransaction(); |
|
34 | |||
35 | 16 | $iteration = 0; |
|
36 | |||
37 | try { |
||
38 | 16 | foreach ($this->items as $key => $value) { |
|
39 | 16 | yield $key => $value; |
|
40 | |||
41 | 16 | $this->flushAndClearBatch(++$iteration); |
|
42 | } |
||
43 | } catch (\Throwable $exception) { |
||
44 | $this->em->rollback(); |
||
45 | |||
46 | throw $exception; |
||
47 | } |
||
48 | |||
49 | 16 | $this->flushAndClear(); |
|
50 | 16 | $this->em->commit(); |
|
51 | 16 | $this->em->getConfiguration()->setSQLLogger($logger); |
|
52 | 16 | } |
|
69 |