Added last check on ShortUrlsOrdering which makes sure everything keeps behaving as it used to

This commit is contained in:
Alejandro Celaya 2020-01-28 11:17:54 +01:00
parent 452bfea088
commit fccd92497a
2 changed files with 6 additions and 1 deletions

View file

@ -60,4 +60,9 @@ final class ShortUrlsOrdering
{
return $this->orderDirection;
}
public function hasOrderField(): bool
{
return $this->orderField !== null;
}
}

View file

@ -40,7 +40,7 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
}
// In case the ordering has been specified, the query could be more complex. Process it
if ($orderBy !== null) {
if ($orderBy !== null && $orderBy->hasOrderField()) {
return $this->processOrderByForList($qb, $orderBy);
}