This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Refactor ProductQuery::merge_queries
to accept multiple queries
#7697
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a73a130
try: refactor merge_queries
dinhtungdu 7c6a9a6
remove debug code
dinhtungdu 679aa5d
Merge branch 'trunk' into refactor/merge_queries
dinhtungdu ba47bf6
Merge branch 'trunk' into refactor/merge_queries
dinhtungdu cd908d5
Merge branch 'trunk' into refactor/merge_queries
dinhtungdu 0f37868
fix: unpack assoc array php 7.4
dinhtungdu c492ce6
try: refactor merge_queries to take any form of input without unpacking
dinhtungdu c8e315c
add missing query vars
dinhtungdu 0a3bb43
cache valid query vars
dinhtungdu e75ee1f
fix merging issue with array_merge_recursive
dinhtungdu 70fa7bf
meta query should be nested arrays
dinhtungdu d5fe319
always merge numeric keys
dinhtungdu bce838b
tax_query should contain single nested array too
dinhtungdu a9ffac4
explain the merge strategy
dinhtungdu e6df617
simplify merge logic to unpack/destructure arrays
dinhtungdu b84013c
Revert "simplify merge logic to unpack/destructure arrays"
dinhtungdu e102ad6
use correct term, thanks Lucio
dinhtungdu c4cd536
Merge branch 'trunk' into refactor/merge_queries
dinhtungdu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is premature optimization, but we recreate
$valid_query_vars
array for each query. Isn't it better to move the creation of$valid_query_vars
outside this function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the head-up. I addressed this in 0a3bb43. To me it's more readability than performance improvement as we don't process more than two level depth arrays at the moment, and we still need to recreate the array each time the class is initialized. But it makes the code easier to read so it makes sense to me to implement the optimization.