Skip to content
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

Added missing check for order of compound keys #2260

Merged
merged 1 commit into from
Dec 9, 2020
Merged

Added missing check for order of compound keys #2260

merged 1 commit into from
Dec 9, 2020

Conversation

cgrabenstein
Copy link

Signed-off-by: Christoph Grabenstein christoph.grabenstein@sensiolabs.de

Q A
Type bug
BC Break no
Fixed issues #2257

Summary

The fix consist of two main changes:

  • added a strict check of the array_keys of the index-key-arrays.
  • added a method that checks if the text indexes are at the same position.

Signed-off-by: Christoph Grabenstein <christoph.grabenstein@sensiolabs.de>
@alcaeus alcaeus changed the base branch from master to 2.1.x December 8, 2020 08:43
@alcaeus alcaeus requested a review from malarzm December 8, 2020 08:43
@alcaeus alcaeus added the Bug label Dec 8, 2020
@alcaeus alcaeus added this to the 2.1.3 milestone Dec 8, 2020
Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I've rebased your PR to make this a bug fix for 2.1. Thanks for contributing this fix! 🎉


private function hasTextIndexesAtSamePosition(IndexInfo $mongoIndex, array $documentIndex) : bool
{
$mongoIndexKeys = $mongoIndex['key'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'd prefer $mongoIndex->getKey() but as we're dealing with array structures here anyway that's a nitpick

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed this. While we do implement ArrayAccess for IndexInfo, I believe it's more sensible to rely on the public API of the class over accessing data as array elements. However, since I'm not sure where we're still doing this we may want to do a separate PR to fix this.

@malarzm
Copy link
Member

malarzm commented Dec 9, 2020

Thanks a a lot @cgrabenstein for providing the fix!

@malarzm malarzm merged commit d8be1b9 into doctrine:2.1.x Dec 9, 2020
@cgrabenstein cgrabenstein deleted the fix-detection-of-unsued-compound-indexes branch December 10, 2020 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants