diff --git a/src/Bundle/ChillTaskBundle/Notification/TaskNotificationHandler.php b/src/Bundle/ChillTaskBundle/Notification/TaskNotificationHandler.php index 1bb434fcc..db10d1bdf 100644 --- a/src/Bundle/ChillTaskBundle/Notification/TaskNotificationHandler.php +++ b/src/Bundle/ChillTaskBundle/Notification/TaskNotificationHandler.php @@ -13,17 +13,14 @@ namespace Chill\TaskBundle\Notification; use Chill\MainBundle\Entity\Notification; use Chill\MainBundle\Notification\NotificationHandlerInterface; -use Chill\PersonBundle\Entity\AccompanyingPeriod; -use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Chill\TaskBundle\Entity\SingleTask; -use Chill\TaskBundle\Repository\SingleTaskAclAwareRepository; use Chill\TaskBundle\Repository\SingleTaskRepository; use Symfony\Component\Translation\TranslatableMessage; use Symfony\Contracts\Translation\TranslatableInterface; final readonly class TaskNotificationHandler implements NotificationHandlerInterface { - public function __construct(private SingleTaskRepository $repository) {} + public function __construct(private SingleTaskRepository $taskRepository) {} public function getTemplate(Notification $notification, array $options = []): string { @@ -34,7 +31,7 @@ final readonly class TaskNotificationHandler implements NotificationHandlerInter { return [ 'notification' => $notification, - 'task' => $this->repository->find($notification->getRelatedEntityId()), + 'task' => $this->taskRepository->find($notification->getRelatedEntityId()), ]; } @@ -58,11 +55,15 @@ final readonly class TaskNotificationHandler implements NotificationHandlerInter return []; } - return $task->get; + if (null !== $task->getCourse()) { + return $task->getCourse()->getParticipations()->getValues(); + } + + return [$task->getPerson()]; } - public function getRelatedEntity(Notification $notification): ?AccompanyingPeriod + public function getRelatedEntity(Notification $notification): ?SingleTask { - return $this->accompanyingPeriodRepository->find($notification->getRelatedEntityId()); + return $this->taskRepository->find($notification->getRelatedEntityId()); } }