mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-30 15:25:16 +01:00
sort entries in repository
This commit is contained in:
parent
34d15eb4d0
commit
bc782eaa72
@ -26,6 +26,7 @@ class EntriesRepository extends EntityRepository
|
|||||||
->where('e.isRead = 0')
|
->where('e.isRead = 0')
|
||||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||||
->andWhere('e.isDeleted=0')
|
->andWhere('e.isDeleted=0')
|
||||||
|
->orderBy('e.createdAt', 'desc')
|
||||||
->getQuery();
|
->getQuery();
|
||||||
|
|
||||||
$paginator = new Paginator($qb);
|
$paginator = new Paginator($qb);
|
||||||
@ -50,6 +51,7 @@ class EntriesRepository extends EntityRepository
|
|||||||
->where('e.isRead = 1')
|
->where('e.isRead = 1')
|
||||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||||
->andWhere('e.isDeleted=0')
|
->andWhere('e.isDeleted=0')
|
||||||
|
->orderBy('e.createdAt', 'desc')
|
||||||
->getQuery();
|
->getQuery();
|
||||||
|
|
||||||
$paginator = new Paginator($qb);
|
$paginator = new Paginator($qb);
|
||||||
@ -74,6 +76,7 @@ class EntriesRepository extends EntityRepository
|
|||||||
->where('e.isFav = 1')
|
->where('e.isFav = 1')
|
||||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||||
->andWhere('e.isDeleted=0')
|
->andWhere('e.isDeleted=0')
|
||||||
|
->orderBy('e.createdAt', 'desc')
|
||||||
->getQuery();
|
->getQuery();
|
||||||
|
|
||||||
$paginator = new Paginator($qb);
|
$paginator = new Paginator($qb);
|
||||||
@ -83,7 +86,6 @@ class EntriesRepository extends EntityRepository
|
|||||||
|
|
||||||
public function findEntries($userId, $isArchived, $isStarred, $isDeleted, $sort, $order)
|
public function findEntries($userId, $isArchived, $isStarred, $isDeleted, $sort, $order)
|
||||||
{
|
{
|
||||||
//TODO tous les paramètres ne sont pas utilisés, à corriger
|
|
||||||
$qb = $this->createQueryBuilder('e')
|
$qb = $this->createQueryBuilder('e')
|
||||||
->select('e')
|
->select('e')
|
||||||
->where('e.userId =:userId')->setParameter('userId', $userId);
|
->where('e.userId =:userId')->setParameter('userId', $userId);
|
||||||
@ -100,6 +102,12 @@ class EntriesRepository extends EntityRepository
|
|||||||
$qb->andWhere('e.isDeleted =:isDeleted')->setParameter('isDeleted', $isDeleted);
|
$qb->andWhere('e.isDeleted =:isDeleted')->setParameter('isDeleted', $isDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('created' === $sort) {
|
||||||
|
$qb->orderBy('e.createdAt', $order);
|
||||||
|
} elseif ('updated' === $sort) {
|
||||||
|
$qb->orderBy('e.updatedAt', $order);
|
||||||
|
}
|
||||||
|
|
||||||
return $qb
|
return $qb
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getResult(Query::HYDRATE_ARRAY);
|
->getResult(Query::HYDRATE_ARRAY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user