mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-27 11:31:05 +00:00
Sort by id is faster
Since it's the primary key
This commit is contained in:
parent
0c83fd5994
commit
2385f891e5
1 changed files with 4 additions and 4 deletions
|
@ -26,7 +26,7 @@ class EntryRepository extends EntityRepository
|
||||||
->leftJoin('e.user', 'u')
|
->leftJoin('e.user', 'u')
|
||||||
->where('e.isArchived = false')
|
->where('e.isArchived = false')
|
||||||
->andWhere('u.id =:userId')->setParameter('userId', $userId)
|
->andWhere('u.id =:userId')->setParameter('userId', $userId)
|
||||||
->orderBy('e.createdAt', 'desc')
|
->orderBy('e.id', 'desc')
|
||||||
->getQuery();
|
->getQuery();
|
||||||
|
|
||||||
$paginator = new Paginator($qb);
|
$paginator = new Paginator($qb);
|
||||||
|
@ -52,7 +52,7 @@ class EntryRepository extends EntityRepository
|
||||||
->leftJoin('e.user', 'u')
|
->leftJoin('e.user', 'u')
|
||||||
->where('e.isArchived = true')
|
->where('e.isArchived = true')
|
||||||
->andWhere('u.id =:userId')->setParameter('userId', $userId)
|
->andWhere('u.id =:userId')->setParameter('userId', $userId)
|
||||||
->orderBy('e.createdAt', 'desc')
|
->orderBy('e.id', 'desc')
|
||||||
->getQuery();
|
->getQuery();
|
||||||
|
|
||||||
$paginator = new Paginator($qb);
|
$paginator = new Paginator($qb);
|
||||||
|
@ -78,7 +78,7 @@ class EntryRepository extends EntityRepository
|
||||||
->leftJoin('e.user', 'u')
|
->leftJoin('e.user', 'u')
|
||||||
->where('e.isStarred = true')
|
->where('e.isStarred = true')
|
||||||
->andWhere('u.id =:userId')->setParameter('userId', $userId)
|
->andWhere('u.id =:userId')->setParameter('userId', $userId)
|
||||||
->orderBy('e.createdAt', 'desc')
|
->orderBy('e.id', 'desc')
|
||||||
->getQuery();
|
->getQuery();
|
||||||
|
|
||||||
$paginator = new Paginator($qb);
|
$paginator = new Paginator($qb);
|
||||||
|
@ -111,7 +111,7 @@ class EntryRepository extends EntityRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('created' === $sort) {
|
if ('created' === $sort) {
|
||||||
$qb->orderBy('e.createdAt', $order);
|
$qb->orderBy('e.id', $order);
|
||||||
} elseif ('updated' === $sort) {
|
} elseif ('updated' === $sort) {
|
||||||
$qb->orderBy('e.updatedAt', $order);
|
$qb->orderBy('e.updatedAt', $order);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue