Conversation
Added error handling for unbalanced WHERE groups and improved condition evaluation logic.
|
Hey — sorry for the late reply. I was in the hospital :( I actually like the idea 👍 What’s missing (unless I overlooked it) are the public APIs to actually use this feature: openWhereGroup($operator = 'AND'|'OR') closeWhereGroup() Without those methods the feature is basically incomplete from the user side (the examples in the PR description wouldn’t work). Could you please add these two methods (plus a short doc/example, and ideally 1–2 tests for nested groups / AND+OR)? Then I’m happy to take another look and merge it. If you want, I can also suggest a minimal implementation that fits the current internal where-stack structure. |
Add methods for open and close groups.
|
Hey @decMuc , Due to a merge conflict, the public methods had actually disappeared... I added them back in. You can find examples, including nested groups, in the description. I can adjust the documentation once the pull request has been merged. Please check my changes and merge them. My local tests are all successful. |
|
Hey @decMuc |
|
@decMuc any updates? |
|
@decMuc Any updates or is this project dead? |
With this PR, it is now possible to group WHERE conditions. This is necessary for more complex WHERE conditions so that RAW queries do not always have to be used.
Examples:
Query:
I have already prepared unit tests for this. However, this requires a redesign of the library, as final classes cannot be mocked and the database connection is already established in the constructor. Here, it is necessary to introduce a parameter that prevents a database connection from being established.