Skip to content

Comments

Skip empty $match from pipeline builder#2740

Merged
GromNaN merged 2 commits intodoctrine:2.11.xfrom
GromNaN:empty-match
Mar 6, 2025
Merged

Skip empty $match from pipeline builder#2740
GromNaN merged 2 commits intodoctrine:2.11.xfrom
GromNaN:empty-match

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Mar 3, 2025

Q A
Type improvement
BC Break no-ish
Fixed issues -

Summary

Don't send an unnecessary stage to the server.

Might be considered as a breaking change is someone manipulate the generated pipeline.

Copy link
Member Author

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

We can do the same for $addFields and $set.

But also for $unsetFields and $project. This stages doesn't accept empty lists, so this can be an improvement.

* @phpstan-return StageExpression
*/
abstract public function getExpression(): array;
abstract public function getExpression(): ?array;
Copy link
Member Author

Choose a reason for hiding this comment

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

Classes extending this can still restrict the return type.

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

Optional test rename.

@GromNaN GromNaN merged commit 75130aa into doctrine:2.11.x Mar 6, 2025
19 checks passed
@GromNaN GromNaN deleted the empty-match branch March 6, 2025 21:34
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.

2 participants