|
@@ -518,12 +518,21 @@ class ElementRepository extends EntityRepository
|
518
|
518
|
$doctrineConfig = $this->getEntityManager()->getConfiguration();
|
519
|
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
|
532
|
return $this->getEntityManager()->createQueryBuilder()
|
522
|
|
- ->select('e, field(e.id, ' . implode(', ', $element_ids) . ') as HIDDEN field')
|
|
533
|
+ ->select('e')
|
523
|
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
|
|