find($taskId) ; $defaultReturnPath = $this->generateUrl( 'chill_task_singletask_list', [ 'person_id' => $task->getPerson() ] ); break; default: return new Response("The type '$kind' is not implemented", Response::HTTP_BAD_REQUEST); } if (NULL === $task) { $this->createNotFoundException("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(TaskVoter::SHOW, $task); $workflow = $registry->get($task); if ($workflow->can($task, $transition)) { $workflow->apply($task, $transition); $em->flush(); $this->addFlash('success', 'The transition is sucessfully appliyed'); } else { $this->addFlash('error', 'The transition could not be appliyed'); } return $this->redirect($request->query->get('return_path', $defaultReturnPath)); } }