diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e74b2..d9700bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/rekapager-doctrine-orm-adapter/src/QueryBuilderAdapter.php b/packages/rekapager-doctrine-orm-adapter/src/QueryBuilderAdapter.php index efddec9..0f9c090 100644 --- a/packages/rekapager-doctrine-orm-adapter/src/QueryBuilderAdapter.php +++ b/packages/rekapager-doctrine-orm-adapter/src/QueryBuilderAdapter.php @@ -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;