Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading