Changed default ordering of short URLs, returning newest first

This commit is contained in:
Alejandro Celaya
2022-01-05 14:10:24 +01:00
parent d3f4263639
commit 44e3f9b49f
4 changed files with 23 additions and 22 deletions

View File

@@ -49,9 +49,8 @@ class ShortUrlRepository extends EntitySpecificationRepository implements ShortU
return $this->processOrderByForList($qb, $orderBy);
}
// With no order by, order by date and just return the list of ShortUrls
$qb->orderBy('s.dateCreated');
return $qb->getQuery()->getResult();
// With no explicit order by, fallback to dateCreated-DESC
return $qb->orderBy('s.dateCreated', 'DESC')->getQuery()->getResult();
}
private function processOrderByForList(QueryBuilder $qb, ShortUrlsOrdering $orderBy): array