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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPORM-255 Enable disabling the
id
to_id
field rename in embedded documents #3332PHPORM-255 Enable disabling the
id
to_id
field rename in embedded documents #3332Changes from all commits
3b4ad5a
f780906
48c14cc
68e57f4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Note that this appears to be the only recursive call to
aliasIdForQuery()
. All other calls (e.g. preparing projections, wheres) are invoked at the root level.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.
There appear to be two calls to
aliasIdForResult()
fromMongoDB\Laravel\Eloquent\Builder::raw()
(see: search results).The context suggests that you're only processing a single document, but in one case you call
iterator_to_array()
on a cursor (which suggests it'd be handling multiple results instead of just one).Neither of the
aliasIdForResult()
calls there seem affected by this change, since$root: false
is only used when recursing, but it'd be worth confirming.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.
Good catch, that's fixed by using
array_map
.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.
Just to confirm, this fix was necessary to get the test case for multiple results passing?
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.
Previously, the function was called with
$root = true
on the list of document, and then each document root had$root = false
because the function was called recursively. Usingarray_map
, I'm callingaliasIdForResult
on the documents directly, instead of the collection of documents.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.
Does this test exercise both
aliasIdForQuery
andaliasIdForResult()
?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.
Thanks for this question, I added a full test to cover both.