From 6736c7491d0d89671ff359786c18f37df87d0ccf Mon Sep 17 00:00:00 2001 From: Jonathan Foucher <jfoucher@gmail.com> Date: Mon, 17 Apr 2023 10:32:07 +0200 Subject: [PATCH] fix getting module name --- .../ORM/Notification/Repository/Notification.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/ORM/Notification/Repository/Notification.php b/src/Infrastructure/ORM/Notification/Repository/Notification.php index ca3a9ee5f..dd00f4aed 100644 --- a/src/Infrastructure/ORM/Notification/Repository/Notification.php +++ b/src/Infrastructure/ORM/Notification/Repository/Notification.php @@ -32,6 +32,7 @@ use App\Domain\User\Dictionary\UserMoreInfoDictionary; use App\Domain\User\Dictionary\UserRoleDictionary; use App\Domain\User\Model\Collectivity; use App\Domain\User\Model\User; +use App\Infrastructure\ORM\Registry\Repository\Mesurement; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Query\Expr\OrderBy; @@ -342,10 +343,14 @@ class Notification extends CRUDRepository implements Repository\Notification } $object = $notification->getObject(); - $moduleName = str_replace('notification.modules.', '', $notification->getModule()); - $objectClass = array_flip(\App\Domain\Notification\Model\Notification::MODULES)[$moduleName]; + if ($moduleName === 'action_plan') { + $objectClass = Mesurement::class; + } else { + $objectClass = array_flip(\App\Domain\Notification\Model\Notification::MODULES)[$moduleName]; + } + return (bool) $this->registry->getRepository($objectClass)->find($object->id); } -- GitLab