Skip to content

Commit

Permalink
fix(QueryBuilderAdapter): now refuses to continue if the same field…
Browse files Browse the repository at this point in the history
… appears multiple times in the order by clause. (#20)
  • Loading branch information
priyadi authored Apr 2, 2024
1 parent ed0377b commit 54a8610
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.6.1

* fix(`QueryBuilderAdapter`): now refuses to continue if the same field appears
multiple times in the order by clause.


## 0.6.0

* test: add tests for zero proximity pager, empty pager, and test current count for all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ private function getSortOrder(): array
$direction = strtoupper($direction);

if (!\in_array($direction, ['ASC', 'DESC'], true)) {
throw new \LogicException('Invalid direction');
throw new LogicException('Invalid direction');
}

if (isset($result[$field])) {
throw new LogicException(sprintf('The field "%s" appears multiple times in the ORDER BY clause.', $field));
}

$result[$field] = $direction;
Expand Down

0 comments on commit 54a8610

Please sign in to comment.