feat: fixes errors on complex where statements and tests required#349
Merged
garak merged 7 commits intoKnpLabs:masterfrom Jun 27, 2025
Merged
feat: fixes errors on complex where statements and tests required#349garak merged 7 commits intoKnpLabs:masterfrom
garak merged 7 commits intoKnpLabs:masterfrom
Conversation
garak
requested changes
Jun 26, 2025
Collaborator
garak
left a comment
There was a problem hiding this comment.
Please apply suggestions given by copilot
Contributor
Author
it breaks the tests if I apply that since It will be wrong typed |
…y/WhereWalkerTest.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…y/WhereWalkerTest.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…RM/Query/WhereWalker.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Enhance the WhereWalker to support nested ConditionalTerm nodes and add tests for complex and simple filter scenarios in WHERE AST traversal.
- Extend
primaryContainsFilterto detect filter expressions withinConditionalTermnodes - Add unit tests covering complex
ConditionalTermcombinations and single-factor filters - Ensure existing filter logic remains intact with additional assertions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Test/Pager/Event/Subscriber/Filtration/Doctrine/ORM/Query/WhereWalkerTest.php | Add tests for complex conditional terms and simple conditional factors in WHERE clauses |
| src/Knp/Component/Pager/Event/Subscriber/Filtration/Doctrine/ORM/Query/WhereWalker.php | Update primaryContainsFilter to handle ConditionalTerm branches alongside ConditionalExpression |
Comments suppressed due to low confidence (2)
src/Knp/Component/Pager/Event/Subscriber/Filtration/Doctrine/ORM/Query/WhereWalker.php:226
- The newly added
ConditionalTermbranch is not exercised by current tests. Add a test that triggerstermContainsFilter()to verify correct handling of this case.
} elseif ($node->conditionalExpression instanceof ConditionalTerm) {
src/Knp/Component/Pager/Event/Subscriber/Filtration/Doctrine/ORM/Query/WhereWalker.php:224
- The
ConditionalTermbranch may never be reached becauseconditionalExpressionis always aConditionalExpression. Consider refactoring to traverse the expression's terms and invoketermContainsFilter()where appropriate.
if ($node->conditionalExpression instanceof ConditionalExpression) {
tests/Test/Pager/Event/Subscriber/Filtration/Doctrine/ORM/Query/WhereWalkerTest.php
Outdated
Show resolved
Hide resolved
garak
approved these changes
Jun 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improves #206 adding the missing tests required