mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Added support for ordering in shortcode:list command
This commit is contained in:
@@ -43,7 +43,11 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
|
||||
$fieldName = is_array($orderBy) ? key($orderBy) : $orderBy;
|
||||
$order = is_array($orderBy) ? $orderBy[$fieldName] : 'ASC';
|
||||
|
||||
if ($fieldName === 'visits') {
|
||||
if (in_array($fieldName, [
|
||||
'visits',
|
||||
'visitsCount',
|
||||
'visitCount',
|
||||
])) {
|
||||
$qb->addSelect('COUNT(v) AS totalVisits')
|
||||
->leftJoin('s.visits', 'v')
|
||||
->groupBy('s')
|
||||
|
||||
Reference in New Issue
Block a user