Browse Source

Anomalie #798: Erreur count new objects

Bastien Sevajol 11 years ago
parent
commit
3dbc923e36
1 changed files with 29 additions and 29 deletions
  1. 29 29
      src/Muzich/CoreBundle/Searcher/ElementSearcherQueryBuilder.php

+ 29 - 29
src/Muzich/CoreBundle/Searcher/ElementSearcherQueryBuilder.php View File

@@ -247,38 +247,38 @@ class ElementSearcherQueryBuilder
247 247
             $tag_ids .= ','.(int)$tag_id;
248 248
           }
249 249
         }
250
-      }
251 250
       
252
-      $sql = "SELECT et.element_id FROM elements_tag et "
253
-      ."WHERE et.tag_id IN ($tag_ids) group by et.element_id "
254
-      ."having count(distinct et.tag_id) = ".count($tags);
255
-      $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
256
-      $rsm->addScalarResult('element_id', 'element_id');
257
-   
258
-      $strict_element_ids_result = $this->em
259
-        ->createNativeQuery($sql, $rsm)
260
-        //->setParameter('ids', $tag_ids)
261
-        ->getScalarResult()
262
-      ;
263
-      
264
-      $strict_element_ids = array();
265
-      if (count($strict_element_ids_result))
266
-      {
267
-        foreach ($strict_element_ids_result as $strict_id)
251
+        $sql = "SELECT et.element_id FROM elements_tag et "
252
+        ."WHERE et.tag_id IN ($tag_ids) group by et.element_id "
253
+        ."having count(distinct et.tag_id) = ".count($tags);
254
+        $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
255
+        $rsm->addScalarResult('element_id', 'element_id');
256
+
257
+        $strict_element_ids_result = $this->em
258
+          ->createNativeQuery($sql, $rsm)
259
+          //->setParameter('ids', $tag_ids)
260
+          ->getScalarResult()
261
+        ;
262
+
263
+        $strict_element_ids = array();
264
+        if (count($strict_element_ids_result))
268 265
         {
269
-          $strict_element_ids[] = $strict_id['element_id'];
266
+          foreach ($strict_element_ids_result as $strict_id)
267
+          {
268
+            $strict_element_ids[] = $strict_id['element_id'];
269
+          }
270
+        }
271
+
272
+        if (count($strict_element_ids))
273
+        {
274
+          $this->query_ids->andWhere('e.id IN (:tag_strict_ids)');
275
+          $this->parameters_ids['tag_strict_ids'] = $strict_element_ids;
276
+        }
277
+        // Ce else palie au bug du au cas ou $strict_element_ids est egal a array();
278
+        else
279
+        {
280
+          return false;
270 281
         }
271
-      }
272
-      
273
-      if (count($strict_element_ids))
274
-      {
275
-        $this->query_ids->andWhere('e.id IN (:tag_strict_ids)');
276
-        $this->parameters_ids['tag_strict_ids'] = $strict_element_ids;
277
-      }
278
-      // Ce else palie au bug du au cas ou $strict_element_ids est egal a array();
279
-      else
280
-      {
281
-        return false;
282 282
       }
283 283
     }
284 284
   }