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