Conditions | 3 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
26 | } |
||
27 | |||
28 | protected function attachSnapshotEvent(bool $keepSnapshots = true): void |
||
29 | { |
||
30 | if ($keepSnapshots) { |
||
31 | $this->getEventsManager()->attach('model', function ($event, $entity) { |
||
32 | |||
33 | switch ($event->getType()) { |
||
34 | case 'beforeCreate': |
||
35 | $entity->setSnapshotData($entity->toArray()); |
||
36 | break; |
||
37 | } |
||
44 |