From 2385f891e5992e84501d4cd47565a7bf0af14331 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 28 Mar 2015 14:28:24 +0100 Subject: Sort by id is faster Since it's the primary key --- src/Wallabag/CoreBundle/Repository/EntryRepository.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 53e8e2ba..a8c138a9 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -26,7 +26,7 @@ class EntryRepository extends EntityRepository ->leftJoin('e.user', 'u') ->where('e.isArchived = false') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.createdAt', 'desc') + ->orderBy('e.id', 'desc') ->getQuery(); $paginator = new Paginator($qb); @@ -52,7 +52,7 @@ class EntryRepository extends EntityRepository ->leftJoin('e.user', 'u') ->where('e.isArchived = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.createdAt', 'desc') + ->orderBy('e.id', 'desc') ->getQuery(); $paginator = new Paginator($qb); @@ -78,7 +78,7 @@ class EntryRepository extends EntityRepository ->leftJoin('e.user', 'u') ->where('e.isStarred = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.createdAt', 'desc') + ->orderBy('e.id', 'desc') ->getQuery(); $paginator = new Paginator($qb); @@ -111,7 +111,7 @@ class EntryRepository extends EntityRepository } if ('created' === $sort) { - $qb->orderBy('e.createdAt', $order); + $qb->orderBy('e.id', $order); } elseif ('updated' === $sort) { $qb->orderBy('e.updatedAt', $order); } -- cgit v1.2.3