Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function process(string $resourceCode, string $filePath): void |
||
40 | { |
||
41 | $importer = $this->importerChain->getImporterForResource($resourceCode); |
||
42 | $data = $this->reader->read($filePath); |
||
43 | |||
44 | foreach ($data as $index => $row) { |
||
45 | try { |
||
46 | $importer->import($row); |
||
47 | } catch (\Exception $exception) { |
||
48 | $index += 1; |
||
49 | |||
50 | throw new ImportFailedException($exception->getMessage(), $index); |
||
51 | } |
||
52 | |||
53 | $this->entityManager->clear(); |
||
54 | } |
||
55 | |||
56 | $importer->cleanup(); |
||
57 | } |
||
59 |