Do not fail displaying notification when workflow has been deleted

This commit is contained in:
2024-11-12 13:57:20 +01:00
parent 3ec0d26001
commit c3cc6c8353
3 changed files with 20 additions and 11 deletions

View File

@@ -33,7 +33,7 @@ class WorkflowNotificationHandler implements NotificationHandlerInterface
return [
'entity_workflow' => $entityWorkflow,
'handler' => $this->entityWorkflowManager->getHandler($entityWorkflow),
'handler' => null !== $entityWorkflow ? $this->entityWorkflowManager->getHandler($entityWorkflow): null,
'notificationCc' => $this->isNotificationCc($notification),
];
}
@@ -45,6 +45,10 @@ class WorkflowNotificationHandler implements NotificationHandlerInterface
if (EntityWorkflow::class === $notification->getRelatedEntityClass()) {
$relatedEntity = $this->entityWorkflowRepository->findOneBy(['id' => $notification->getRelatedEntityId()]);
if (null === $relatedEntity) {
return false;
}
if ($relatedEntity->getCurrentStepCreatedBy() !== $this->security->getUser()) {
$notificationCc = true;
}