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

Don't merge PersistentCollection orderBy with criteria in matching() #7850

Merged

Conversation

paxuclus
Copy link
Contributor

@paxuclus paxuclus commented Oct 1, 2019

If no orderings are given to PersistentCollection::matching(), the
orderBy annotation will be used if present. If the criteria contains
orderings, those will be used without merging them with the orderBy.

See #7836

@paxuclus paxuclus force-pushed the nlx-lars/bugfix/7836-dont-merge-criteria branch from dc452c4 to cfb357f Compare October 1, 2019 19:55
Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

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

@nlx-lars thank you for this well-crafted changeset! Not merging arrays is indeed a more sensible option since it removes potential WTFs (thanks @SenseException).

I just have this tiny request 👍


$children = $parent->getChildren()->matching(Criteria::create());

self::assertEquals(100, $children[0]->position);
Copy link
Member

Choose a reason for hiding this comment

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

Please use self::assertSame() to be a bit more strict (yay strictness 🤘)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@lcobucci lcobucci self-assigned this Oct 1, 2019
@lcobucci lcobucci added the Bug label Oct 1, 2019
@lcobucci lcobucci added this to the 2.6.5 milestone Oct 1, 2019
@lcobucci lcobucci assigned paxuclus and unassigned lcobucci Oct 1, 2019
If no orderings are given to PersistentCollection::matching(), the
orderBy annotation will be used if present. If the criteria contains
orderings, those will be used without merging them with the orderBy.

See doctrine#7836
@paxuclus paxuclus force-pushed the nlx-lars/bugfix/7836-dont-merge-criteria branch from cfb357f to 79a7ecc Compare October 2, 2019 07:23
Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

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

Perfect, thanks!

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.

None yet

2 participants