mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
do not add referrer if user is null (fix condition)
This commit is contained in:
parent
efeda81e05
commit
704392a729
@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\EventListener;
|
namespace Chill\PersonBundle\EventListener;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ class AccompanyingPeriodWorkEventListener
|
|||||||
|
|
||||||
public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void
|
public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void
|
||||||
{
|
{
|
||||||
if (null !== $this->security->getUser()) {
|
if ($this->security->getUser() instanceof User) {
|
||||||
$work->addReferrer($this->security->getUser());
|
$work->addReferrer($this->security->getUser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user