Controller/WikiTagController.php
changeset 16 876df98c9208
parent 15 ab71cf8bff55
child 21 780ef37e63b9
--- a/Controller/WikiTagController.php	Wed Oct 26 16:02:46 2011 +0200
+++ b/Controller/WikiTagController.php	Wed Oct 26 18:30:13 2011 +0200
@@ -430,6 +430,7 @@
         
         // We get the needed datas in an array($tags, $num_page, $nb_by_page, $searched, $sort, $reverse_sort, $pagerfanta);
         $ar = $this->getAllTags($num_page, $nb_by_page, $sort, $searched);
+        //return new Response($ar);
         $tags = $ar[0];
         $num_page = $ar[1];
         $nb_by_page = $ar[2];
@@ -518,11 +519,12 @@
         $qb->leftJoin('t.documents', 'dt', 'WITH', 't = dt.tag');
         $qb->addGroupBy('t.id');
         
-        // We add the search string if necessary ('* bugs)
-        if($searched!="" && $searched!="'*"){
-            // We replace "*" by "%".
-            $qb->where($qb->expr()->orx($qb->expr()->like('t.normalizedLabel', "'".str_replace("*", "%", $searched)."'")));
+        // We add the search string if necessary
+        if($searched!=""){
+            // We replace "*" by "%", and doctrine wants ' to be ''.
+            $qb->where($qb->expr()->orx($qb->expr()->like('t.normalizedLabel', "'".str_replace("'", "''", str_replace("*", "%", $searched))."'")));
         }
+        //return $qb->getDql();
         
         // We add the sorting criteria
         if($sort==NULL){