NEW Allow filtering and excluding based on another list#11804
Merged
emteknetnz merged 3 commits intosilverstripe:6from Aug 6, 2025
Merged
NEW Allow filtering and excluding based on another list#11804emteknetnz merged 3 commits intosilverstripe:6from
emteknetnz merged 3 commits intosilverstripe:6from
Conversation
8624e95 to
d7c4606
Compare
GuySartorelli
commented
Jul 28, 2025
GuySartorelli
commented
Jul 28, 2025
039ed54 to
ad2cbf5
Compare
GuySartorelli
commented
Jul 29, 2025
GuySartorelli
commented
Jul 29, 2025
This was referenced Jul 30, 2025
63d7a42 to
16b86bf
Compare
GuySartorelli
commented
Aug 4, 2025
GuySartorelli
commented
Aug 4, 2025
16b86bf to
a83949f
Compare
a83949f to
7839a27
Compare
GuySartorelli
commented
Aug 4, 2025
GuySartorelli
commented
Aug 4, 2025
dfb00a9 to
0b4c27a
Compare
emteknetnz
requested changes
Aug 4, 2025
0b4c27a to
8a41d39
Compare
emteknetnz
requested changes
Aug 5, 2025
| */ | ||
| public function filterByList(SS_List $list, string $fieldToFilterBy = 'ID', string $fieldInOtherList = 'ID'): static | ||
| { | ||
| $thisDataClass = $this->dataClass(); |
Member
There was a problem hiding this comment.
If not a trait, then do as a private method, similar to DataList
| */ | ||
| public function excludeByList(SS_List $list, string $fieldToFilterBy = 'ID', string $fieldInOtherList = 'ID'): static | ||
| { | ||
| $thisDataClass = $this->dataClass(); |
Member
There was a problem hiding this comment.
Same as as linked comment, all of it if viable assuming you can tolerate a dynamic method call
This provides a convenient shortcut for e.g. filtering a list of pages by the IDs of a relation, where the relation IDs come from a separate pre-filtered query. Using this instead of executing the first query and filtering by IDs allows the database optimiser to optimise a joint query and reduces latency overhead of performing separate queries.
Some queries can be combined using the new filterByList and excludeByList queries on DataList. This reduces latency overhead and provides an opportunity for the database optimiser to do its thing
8a41d39 to
cdeb949
Compare
emteknetnz
approved these changes
Aug 6, 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.
Important
There are multiple commits. DO NOT SQUASH
This provides a convenient shortcut for e.g. filtering a list of pages by the IDs of a relation, where the relation IDs come from a separate pre-filtered query.
Using this instead of executing the first query and filtering by IDs (or by other fields) allows the database optimiser to optimise a joint query and reduces latency overhead of performing separate queries.
Issue