[11.x] Add whereNone
method to the query builder
#52260
Merged
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 pull request complements the work done by @musiermoore in the PR 50344 where the
whereAny
andwhereAll
methods were added to the framework. The newwhereNone
method is the often more forgotten "little sibling" / negative path function to complete this family of methods.Similar to
whereAny
andwhereAll
, thewhereNone
method operates on multiple columns, but it uses negation to achieve the opposite effect ofwhereAny
. This method gives users the ability to query for records where none of the specified columns match the given condition, thus completing the logical triad of "any", "all", and "none".The
whereNone
method works as follows:This will generate the following SQL:
By adding whereNone, we complete the set of methods for handling constraints across multiple columns.