fix error in delete action: route name, misplaced 404 errors

This commit is contained in:
2018-05-04 11:15:46 +02:00
parent 9fc55054cb
commit 0df80041fb
2 changed files with 6 additions and 5 deletions

View File

@@ -219,6 +219,10 @@ class SingleTaskController extends Controller
$taskRepository = $this->get('chill_task.single_task_repository');
$task = $taskRepository->find($id);
if (!$task) {
throw $this->createNotFoundException('Unable to find Task entity.');
}
if (!is_null($task->getPerson() === !null)) {
@@ -240,10 +244,6 @@ class SingleTaskController extends Controller
$this->denyAccessUnlessGranted(TaskVoter::DELETE, $task, 'You are not '
. 'allowed to delete this task');
if (!$task) {
throw $this->createNotFoundException('Unable to find Task entity.');
}
$form = $this->createDeleteForm($id);
if ($request->getMethod() === Request::METHOD_DELETE) {
@@ -271,7 +271,7 @@ class SingleTaskController extends Controller
->trans("The task has been successfully removed."));
return $this->redirect($this->generateUrl(
'chill_task_task_list_by_person', array(
'chill_task_singletask_list', array(
'person_id' => $personId
)));
}