Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Services | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 1 |
| runImport | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
30 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsdldb\Importer\MySQL; |
| 4 | |
| 5 | class Services extends Base |
| 6 | { |
| 7 | protected $entityClass = '\\BO\\Zmsdldb\\Importer\\MySQL\\Entity\\Service'; |
| 8 | |
| 9 | public function runImport(): bool |
| 10 | { |
| 11 | try { |
| 12 | if ($this->needsUpdate()) { |
| 13 | foreach ($this->getIterator() as $service) { |
| 14 | $service = $this->createEntity($service); |
| 15 | $this->removeEntityFromCurrentList($service->get('id')); |
| 16 | $service->save(); |
| 17 | } |
| 18 | } else { |
| 19 | print_r('NO Services(' . $this->getLocale() . ') Update needet' . \PHP_EOL); |
| 20 | } |
| 21 | /* |
| 22 | error_log( |
| 23 | print_r([ |
| 24 | 'delete', |
| 25 | $this->entityClass::getTableName(), |
| 26 | $this->getLocale(), |
| 27 | count($this->getCurrentEntitys()), |
| 28 | array_keys($this->getCurrentEntitys()) |
| 29 | ], |
| 30 | 1)); |
| 31 | */ |
| 32 | |
| 33 | foreach ($this->getCurrentEntitys() as $entityToDelete) { |
| 34 | $entityToDelete->delete(); |
| 35 | } |
| 36 | $this->saveMetaObject(); |
| 37 | } catch (\Exception $e) { |
| 38 | throw $e; |
| 39 | } |
| 40 | |
| 41 | return true; |
| 42 | } |
| 43 | } |