Browse Source

Anomalie #814: Err 500 Playlists (delete track)

Bastien Sevajol 11 years ago
parent
commit
13ca6baf15
1 changed files with 13 additions and 4 deletions
  1. 13 4
      src/Muzich/CoreBundle/Repository/ElementRepository.php

+ 13 - 4
src/Muzich/CoreBundle/Repository/ElementRepository.php View File

518
     $doctrineConfig = $this->getEntityManager()->getConfiguration();
518
     $doctrineConfig = $this->getEntityManager()->getConfiguration();
519
     $doctrineConfig->addCustomStringFunction('FIELD', 'Muzich\CoreBundle\DoctrineExtensions\Query\Mysql\Field');
519
     $doctrineConfig->addCustomStringFunction('FIELD', 'Muzich\CoreBundle\DoctrineExtensions\Query\Mysql\Field');
520
     
520
     
521
+    if (count($element_ids))
522
+    {
523
+      return $this->getEntityManager()->createQueryBuilder()
524
+        ->select('e, field(e.id, ' . implode(', ', $element_ids) . ') as HIDDEN field')
525
+        ->from('MuzichCoreBundle:Element', 'e')
526
+        ->where('e.id IN (:element_ids)')
527
+        ->setParameter('element_ids', $element_ids)
528
+        ->orderBy('field')
529
+      ;
530
+    }
531
+    
521
     return $this->getEntityManager()->createQueryBuilder()
532
     return $this->getEntityManager()->createQueryBuilder()
522
-      ->select('e, field(e.id, ' . implode(', ', $element_ids) . ') as HIDDEN field')
533
+      ->select('e')
523
       ->from('MuzichCoreBundle:Element', 'e')
534
       ->from('MuzichCoreBundle:Element', 'e')
524
-      ->where('e.id IN (:element_ids)')
525
-      ->setParameter('element_ids', $element_ids)
526
-      ->orderBy('field')
535
+      ->where('1 = 2')
527
     ;
536
     ;
528
   }
537
   }
529
   
538