Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
Topics | |
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 Topics extends Base |
6 | { |
7 | protected $entityClass = '\\BO\\Zmsdldb\\Importer\\MySQL\\Entity\\Topic'; |
8 | |
9 | public function runImport(): bool |
10 | { |
11 | try { |
12 | if ($this->needsUpdate()) { |
13 | foreach ($this->getIterator() as $topic) { |
14 | $topic = $this->createEntity($topic); |
15 | $this->removeEntityFromCurrentList($topic->get('id')); |
16 | $topic->save(); |
17 | } |
18 | } else { |
19 | print_r('NO Topics(' . $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 | 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 | } |