From e80a6e417b271428a646e214c9e54dce30d76cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 24 Apr 2023 15:39:39 +0200 Subject: [PATCH] Feature: Track update of entities if no user is associated to the request This happens in scripts/cli (messenger, ...) --- .../Doctrine/Event/TrackCreateUpdateSubscriber.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php index 26a302b13..166003f73 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php @@ -62,11 +62,11 @@ class TrackCreateUpdateSubscriber implements EventSubscriber protected function onUpdate(object $object): void { if ($object instanceof TrackUpdateInterface) { - $object->setUpdatedAt(new DateTimeImmutable('now')); + $object->setUpdatedAt(new DateTimeImmutable('now')); - if ($this->security->getUser() instanceof User) { - $object->setUpdatedBy($this->security->getUser()); - } + if ($this->security->getUser() instanceof User) { + $object->setUpdatedBy($this->security->getUser()); + } } } }