From 5292f319becb73231ea8bf7addf349462c738691 Mon Sep 17 00:00:00 2001 From: Tchama Date: Tue, 4 Aug 2020 10:04:25 +0200 Subject: [PATCH] sf4, adding workflow and fix errors for task bundle --- Controller/SingleTaskController.php | 12 +++++++++--- DependencyInjection/Configuration.php | 4 ++-- Resources/translations/messages.fr.yml | 9 ++++----- Resources/views/SingleTask/index.html.twig | 4 +++- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Controller/SingleTaskController.php b/Controller/SingleTaskController.php index 612acd638..59e414907 100644 --- a/Controller/SingleTaskController.php +++ b/Controller/SingleTaskController.php @@ -75,7 +75,9 @@ class SingleTaskController extends Controller ; if ($request->query->has('person_id')) { - $personId = $request->query->getInt('person_id', null); + + $personId = $request->query->getInt('person_id', 0); // sf4 check: + // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` if ($personId === null) { return new Response("You must provide a person_id", Response::HTTP_BAD_REQUEST); @@ -454,7 +456,9 @@ class SingleTaskController extends Controller if ($request->query->get('user_id') === '_unassigned') { $params['unassigned'] = true; } else { - $userId = $request->query->getInt('user_id', null); + $userId = $request->query->getInt('user_id', 0); // sf4 check: + // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` + $user = $this->getDoctrine()->getManager() ->getRepository('ChillMainBundle:User') ->find($userId); @@ -470,7 +474,9 @@ class SingleTaskController extends Controller if (!empty($request->query->get('scope_id'))) { - $scopeId = $request->query->getInt('scope_id', null); + $scopeId = $request->query->getInt('scope_id', 0); // sf4 check: + // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` + $scope = $this->getDoctrine()->getManager() ->getRepository('ChillMainBundle:Scope') ->find($scopeId); diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index e0989cd69..21d50c7f5 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -17,8 +17,8 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('chill_task'); + $treeBuilder = new TreeBuilder('chill_task'); + $rootNode = $treeBuilder->getRootNode('chill_task'); // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 80d3065b1..49a4c2e09 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -15,7 +15,6 @@ Scope: Cercle Task: Tâche Details: Détails Person: Personne -Scope: Cercle Date: Date Dates: Dates User: Utilisateur @@ -74,10 +73,10 @@ cancel: annuler Start_verb: Démarrer Close_verb: Clotûrer Set this task to cancel state: Marquer cette tâche comme annulée -'%user% has closed the task': %user% a fermé la tâche -'%user% has canceled the task': %user% a annulé la tâche -'%user% has started the task': %user% a commencé la tâche -'%user% has created the task': %user% a introduit la tâche +'%user% has closed the task': '%user% a fermé la tâche' +'%user% has canceled the task': '%user% a annulé la tâche' +'%user% has started the task': '%user% a commencé la tâche' +'%user% has created the task': '%user% a introduit la tâche' Are you sure you want to close this task ?: Êtes-vous sûrs de vouloir clotûrer cette tâche ? Are you sure you want to cancel this task ?: Êtes-vous sûrs de vouloir annuler cette tâche ? Are you sure you want to start this task ?: Êtes-vous sûrs de vouloir démarrer cette tâche ? diff --git a/Resources/views/SingleTask/index.html.twig b/Resources/views/SingleTask/index.html.twig index f6509015f..f7bf4dfce 100644 --- a/Resources/views/SingleTask/index.html.twig +++ b/Resources/views/SingleTask/index.html.twig @@ -31,7 +31,8 @@ {# filter tasks #} - +{% block filtertasks %}{# + sf4 check: prevent error message: `A block definition cannot be nested under non-capturing nodes.` #} {% if person is not null %} {% block personcontent %} {% include 'ChillTaskBundle:SingleTask:_list.html.twig' %} @@ -43,3 +44,4 @@ {% endblock %} {% endif %} +{% endblock %}