Document associative array where clauses #10583
Merged
+9
−0
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.
In January 2016 a feature was added to allow where clauses with associative arrays, where the column name is the array key and the where value is the array value. It seems like this was never documented, however I imagine since it's such an intuitive way to use the where clause a number of projects are likely using it without realising it's an undocumented feature. It's also a good feature that should stay as it's a common use case to already have such an array and want to be able to use it in a query.
Code block (the else statement is the feature implementation):
This code is still there in the latest version.