From 0b580658def7ba12b0b29b7b8fcd6f2c46d27162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 26 Jun 2025 14:38:12 +0200 Subject: [PATCH] Remove unnecessary workflow deletion logic when in the initial position --- .changes/unreleased/Feature-20250626-143735.yaml | 6 ++++++ .../Service/Workflow/CancelStaleWorkflowHandler.php | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 .changes/unreleased/Feature-20250626-143735.yaml diff --git a/.changes/unreleased/Feature-20250626-143735.yaml b/.changes/unreleased/Feature-20250626-143735.yaml new file mode 100644 index 000000000..b1a447016 --- /dev/null +++ b/.changes/unreleased/Feature-20250626-143735.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Do not remove workflow which are automatically canceled after staling for more than 30 days +time: 2025-06-26T14:37:35.267672192+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php b/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php index d392df1ca..4dec39572 100644 --- a/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php +++ b/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php @@ -58,7 +58,6 @@ final readonly class CancelStaleWorkflowHandler $transitions = $workflowComponent->getEnabledTransitions($workflow); $transitionApplied = false; - $wasInInitialPosition = 'initial' === $workflow->getStep(); foreach ($transitions as $transition) { if ($this->willTransitionLeadToFinalNegative($transition, $metadataStore)) { @@ -80,10 +79,6 @@ final readonly class CancelStaleWorkflowHandler throw new UnrecoverableMessageHandlingException(sprintf('No valid transition found for EntityWorkflow %d.', $workflowId)); } - if ($wasInInitialPosition) { - $this->em->remove($workflow); - } - $this->em->flush(); }