PHRAS-1107 Fix order pagination in repository

This commit is contained in:
Thibaud Fabre
2016-05-19 19:00:06 +02:00
parent 0e3ed6ed94
commit 3381d18b22
4 changed files with 26 additions and 13 deletions

View File

@@ -41,11 +41,13 @@ class OrderRepository extends EntityRepository
public function listOrders($baseIds, $offsetStart = 0, $perPage = 20, $sort = "created_on")
{
$qb = $this
->createQueryBuilder('o')
->innerJoin('o.elements', 'e');
->createQueryBuilder('o');
if (!empty($baseIds)) {
$qb->where($qb->expr()->in('e.baseId', $baseIds));
$qb
->innerJoin('o.elements', 'e')
->where($qb->expr()->in('e.baseId', $baseIds))
->groupBy('o.id');
}
if ($sort === 'user') {