Conditions | 4 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function prePersist(LifecycleEventArgs $args): void |
||
28 | { |
||
29 | $entity = $args->getEntity(); |
||
30 | $token = $this->tokenStorage->getToken(); |
||
31 | |||
32 | if ($entity instanceof ArticleInterface && $token instanceof TokenInterface) { |
||
33 | $user = $token->getUser(); |
||
34 | |||
35 | if ($user instanceof AdminUserInterface) { |
||
36 | $entity->setAuthor($user); |
||
37 | } |
||
41 |