From c1e5f4a57e15bd0ac297a41a4c3d4f0035850079 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 28 Aug 2024 17:15:38 +0200 Subject: [PATCH] Move onHold methods to a separate WorkflowOnHold controller --- .../Controller/WorkflowOnHoldController.php | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Controller/WorkflowOnHoldController.php diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowOnHoldController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowOnHoldController.php new file mode 100644 index 000000000..4d86dfb0a --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowOnHoldController.php @@ -0,0 +1,59 @@ +getCurrentStep(); + $currentUser = $this->security->getUser(); + + $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); + + $enabledTransitions = $workflow->getEnabledTransitions($entityWorkflow); + $usersInvolved = $entityWorkflow->getUsersInvolved(); + + /* if (count($enabledTransitions) > 0) { + + }*/ + + $stepHold = new EntityWorkflowStepHold($currentStep, $currentUser); + + $this->entityManager->persist($stepHold); + $this->entityManager->flush(); + + return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); + } + + #[Route(path: '/{_locale}/main/workflow/{holdId}/remove_hold', name: 'chill_main_workflow_remove_hold')] + public function removeOnHold(int $holdId, Request $request): Response + { + $hold = $this->entityWorkflowStepHoldRepository->findById($holdId); + $entityWorkflow = $hold->getStep()->getEntityWorkflow(); + + $this->entityManager->remove($hold); + $this->entityManager->flush(); + + return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); + } +}