From 704392a729471bf2ed0b363e4b670710f8eb5fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 21 Mar 2022 15:21:29 +0100 Subject: [PATCH] do not add referrer if user is null (fix condition) --- .../EventListener/AccompanyingPeriodWorkEventListener.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php index 95ab71d4b..83f9ca460 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\EventListener; +use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Symfony\Component\Security\Core\Security; @@ -25,7 +26,7 @@ class AccompanyingPeriodWorkEventListener public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void { - if (null !== $this->security->getUser()) { + if ($this->security->getUser() instanceof User) { $work->addReferrer($this->security->getUser()); } }