[11.x] Update signature of the where(All|Any) methods, make $operator argument required #52384
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.
This PR proposes to update the signature of the where(All|Any) methods, and potentially the whereNot(All|Any) methods as well. The current implementation has an unintuitive default behavior that may lead to unexpected results.
Current issue:
The
$operator
argument is optional and defaults tonull
. This default leads to an unexpected IS NULL condition in the generated SQL when no arguments are provided. Intuitively, one might expect a WHERE EXISTS statement or an equality check (=) if no argument was passed, rather than the current IS NULL behavior.For example:
will generate
Proposed change:
Modify the method signature to require the $operator argument. This change would align the method behavior with developer expectations and prevent unintended IS NULL conditions.
Note: This PR is currently in draft status pending the resolution of the following related PRs:
whereNone
towhereNotAny
in the query builder #52383whereNotAll
method to the query builder #52361