Refactor user suggestion logic in workflow

Removed duplicate user suggestion handling from `WorkflowController` and centralized it in `WorkflowStepType`. This change simplifies the controller and makes user suggestion logic more maintainable.
This commit is contained in:
2024-10-22 23:51:48 +02:00
parent 85dc9bdb2f
commit 968835a262
2 changed files with 7 additions and 11 deletions

View File

@@ -300,19 +300,12 @@ class WorkflowController extends AbstractController
if (\count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
// possible transition
$stepDTO = new WorkflowTransitionContextDTO($entityWorkflow);
$usersInvolved = $entityWorkflow->getUsersInvolved();
$currentUserFound = array_search($this->security->getUser(), $usersInvolved, true);
if (false !== $currentUserFound) {
unset($usersInvolved[$currentUserFound]);
}
$transitionForm = $this->createForm(
WorkflowStepType::class,
$stepDTO,
[
'entity_workflow' => $entityWorkflow,
'suggested_users' => $usersInvolved,
]
);