find($taskId) ; $defaultReturnPath = $this->generateUrl( 'chill_task_task_list_by_person', [ 'personId' => $task->getPerson() ] ); break; default: return new Response("The type '$type' is not implemented", Response::HTTP_BAD_REQUEST); } if (NULL === $task) { $this->createHttpNotFoundException("task with id '$taskId' and type " . "'$type' does not exists"); } // we simply check that the user can see the task. Other ACL checks // should be performed using `guard` events. $this->denyAccessUnlessGranted($task, TaskVoter::SHOW); $workflow = $registry->get($task); if ($workflow->can($task, $transition)) { $workflow->apply($task, $transition); $em->flush(); $this->addFlash('success', 'The transition is sucessfully applyed'); } else { $this->addFlash('error', 'The transition could not be applyed'); } return $this->redirect($request->query->get('return_path', $defaultReturnPath)); } }