aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy <jeremy.benoist@gmail.com>2015-03-28 14:28:24 +0100
committerJeremy <jeremy.benoist@gmail.com>2015-03-31 22:47:43 +0200
commit2385f891e5992e84501d4cd47565a7bf0af14331 (patch)
treeec3c02c3a71bc5950635b3e17d1ead336db6bd22
parent0c83fd5994861efa728097dd151c994796c39ae1 (diff)
downloadwallabag-2385f891e5992e84501d4cd47565a7bf0af14331.tar.gz
wallabag-2385f891e5992e84501d4cd47565a7bf0af14331.tar.zst
wallabag-2385f891e5992e84501d4cd47565a7bf0af14331.zip
Sort by id is faster
Since it's the primary key
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php8
1 files changed, 4 insertions, 4 deletions
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
26 ->leftJoin('e.user', 'u') 26 ->leftJoin('e.user', 'u')
27 ->where('e.isArchived = false') 27 ->where('e.isArchived = false')
28 ->andWhere('u.id =:userId')->setParameter('userId', $userId) 28 ->andWhere('u.id =:userId')->setParameter('userId', $userId)
29 ->orderBy('e.createdAt', 'desc') 29 ->orderBy('e.id', 'desc')
30 ->getQuery(); 30 ->getQuery();
31 31
32 $paginator = new Paginator($qb); 32 $paginator = new Paginator($qb);
@@ -52,7 +52,7 @@ class EntryRepository extends EntityRepository
52 ->leftJoin('e.user', 'u') 52 ->leftJoin('e.user', 'u')
53 ->where('e.isArchived = true') 53 ->where('e.isArchived = true')
54 ->andWhere('u.id =:userId')->setParameter('userId', $userId) 54 ->andWhere('u.id =:userId')->setParameter('userId', $userId)
55 ->orderBy('e.createdAt', 'desc') 55 ->orderBy('e.id', 'desc')
56 ->getQuery(); 56 ->getQuery();
57 57
58 $paginator = new Paginator($qb); 58 $paginator = new Paginator($qb);
@@ -78,7 +78,7 @@ class EntryRepository extends EntityRepository
78 ->leftJoin('e.user', 'u') 78 ->leftJoin('e.user', 'u')
79 ->where('e.isStarred = true') 79 ->where('e.isStarred = true')
80 ->andWhere('u.id =:userId')->setParameter('userId', $userId) 80 ->andWhere('u.id =:userId')->setParameter('userId', $userId)
81 ->orderBy('e.createdAt', 'desc') 81 ->orderBy('e.id', 'desc')
82 ->getQuery(); 82 ->getQuery();
83 83
84 $paginator = new Paginator($qb); 84 $paginator = new Paginator($qb);
@@ -111,7 +111,7 @@ class EntryRepository extends EntityRepository
111 } 111 }
112 112
113 if ('created' === $sort) { 113 if ('created' === $sort) {
114 $qb->orderBy('e.createdAt', $order); 114 $qb->orderBy('e.id', $order);
115 } elseif ('updated' === $sort) { 115 } elseif ('updated' === $sort) {
116 $qb->orderBy('e.updatedAt', $order); 116 $qb->orderBy('e.updatedAt', $order);
117 } 117 }