Lines
0.00%
0 / 13
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Authorities | 0.00% | 0 / 13 | 0.00% | 0 / 1 | 42 | 0.00% | 0 / 1 | |||
| runImport | 0.00% | 0 / 13 | 0.00% | 0 / 1 | 42 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsdldb\Importer\MySQL; | |
| 4 | ||
| 5 | class Authorities extends Base | |
| 6 | { | |
| 7 | /** @var class-string<\BO\Zmsdldb\Importer\MySQL\Entity\Base>|null */ | |
| 8 | protected ?string $entityClass = \BO\Zmsdldb\Importer\MySQL\Entity\Authority::class; | |
| 9 | ||
| 10 | /** @psalm-api */ | |
| 11 | #[\Override] | |
| 12 | public function runImport(): bool | |
| 13 | { | |
| 14 | try { | |
| 15 | if ($this->needsUpdate()) { | |
| 16 | foreach ($this->getIterator() as $authority) { | |
| 17 | if (!is_array($authority)) { | |
| 18 | continue; | |
| 19 | } | |
| 20 | $authority = $this->createEntity($authority); | |
| 21 | $this->removeEntityFromCurrentList((int) $authority->get('id')); | |
| 22 | $authority->save(); | |
| 23 | } | |
| 24 | } | |
| 25 | foreach ($this->getCurrentEntitys() as $entityToDelete) { | |
| 26 | $entityToDelete->delete(); | |
| 27 | } | |
| 28 | $this->saveMetaObject(); | |
| 29 | } catch (\Exception $e) { | |
| 30 | throw $e; | |
| 31 | } | |
| 32 | ||
| 33 | return true; | |
| 34 | } | |
| 35 | } |