From ba5406544361f3252fef42be3e48d4d09c9bfa86 Mon Sep 17 00:00:00 2001 From: afornerot Date: Thu, 22 Aug 2019 10:16:30 +0200 Subject: [PATCH] ajout colonne niveau01 (fixes #18) --- .../Controller/Niveau02Controller.php | 17 +++++++++++++---- .../Resources/views/Niveau02/list.html.twig | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php index 069e57fb..f05fd500 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/Niveau02Controller.php @@ -53,7 +53,9 @@ class Niveau02Controller extends Controller $totalf= $em->createQueryBuilder() ->select('COUNT(table)') ->from($this->labelentity,'table') - ->where('table.label LIKE :value') + ->from("CadolesCoreBundle:Niveau01",'nv1') + ->where('table.niveau01=nv1.id') + ->andwhere('table.label LIKE :value or nv1.label LIKE :value') ->setParameter("value", "%".$search["value"]."%") ->getQuery() ->getSingleScalarResult(); @@ -69,13 +71,19 @@ class Niveau02Controller extends Controller // Parcours des Enregistrement $qb = $em->createQueryBuilder(); - $qb->select('table')->from($this->labelentity,'table'); + $qb->select('table') + ->from($this->labelentity,'table') + ->from("CadolesCoreBundle:Niveau01",'nv1') + ->where('table.niveau01=nv1.id'); if($search["value"]!="") { - $qb ->where('table.label LIKE :value') + $qb ->andwhere('table.label LIKE :value or nv1.label LIKE :value') ->setParameter("value", "%".$search["value"]."%"); } switch($order[0]["column"]) { case 1 : + $qb->orderBy('nv1.label',$order[0]["dir"]); + break; + case 2 : $qb->orderBy('table.label',$order[0]["dir"]); break; } @@ -83,9 +91,10 @@ class Niveau02Controller extends Controller $datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult(); foreach($datas as $data) { + //dump($data); $action ="$data->getId()))."'>"; if($data->getId()>0) $action.="$data->getId()))."'>"; - array_push($output["data"],array($action,$data->getLabel())); + array_push($output["data"],array($action,$data->getNiveau01()->getLabel(),$data->getLabel())); } // Retour diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau02/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau02/list.html.twig index d8cd7884..141d203d 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau02/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Niveau02/list.html.twig @@ -16,7 +16,8 @@ Action - Label + {{ labelniveau01 }} + {{ labelniveau02 }}