Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
14 | 32 | public function prePersist(LifecycleEventArgs $args): void |
|
15 | { |
||
16 | 32 | $entity = $args->getEntity(); |
|
17 | |||
18 | 32 | if (is_a($entity, UuidEntityInterface::class)) { |
|
19 | /** @var UuidEntityInterface $uuidEntity */ |
||
20 | 32 | $uuidEntity = $entity; |
|
21 | 32 | if (null === $uuidEntity->getUuid()) { |
|
22 | 4 | $uuidEntity->setUuid(Uuid::uuid4()->toString()); |
|
23 | } |
||
24 | } |
||
25 | 32 | } |
|
26 | } |
||
27 |