From 0df80041fb4d6dedaebda03204f3a91b5ec948a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 4 May 2018 11:15:46 +0200 Subject: [PATCH] fix error in delete action: route name, misplaced 404 errors --- Controller/SingleTaskController.php | 10 +++++----- Resources/translations/messages.fr.yml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Controller/SingleTaskController.php b/Controller/SingleTaskController.php index 002d92bd1..521fb8a92 100644 --- a/Controller/SingleTaskController.php +++ b/Controller/SingleTaskController.php @@ -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 ))); } diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 729ebdc57..6fff1a30e 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -66,6 +66,7 @@ cancel: annuler #Flash messages 'The task is created': 'La tâche a été créée' +'There is no tasks.': Aucune tâche. 'The task has been successfully removed.': 'La tâche a bien été supprimée' 'This form contains errors': 'Ce formulaire contient des erreurs' 'The task has been updated': 'La tâche a été mise à jour'