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