Improved code

This commit is contained in:
Alejandro Celaya
2018-08-01 20:28:05 +02:00
parent 899771cc2e
commit f4b569c245
2 changed files with 10 additions and 10 deletions

View File

@@ -57,10 +57,11 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
->orderBy('totalVisits', $order);
return \array_column($qb->getQuery()->getResult(), 0);
} elseif (\in_array($fieldName, ['originalUrl', 'shortCode', 'dateCreated'], true)) {
$qb->orderBy('s.' . $fieldName, $order);
}
if (\in_array($fieldName, ['originalUrl', 'shortCode', 'dateCreated'], true)) {
$qb->orderBy('s.' . $fieldName, $order);
}
return $qb->getQuery()->getResult();
}