-
-
Notifications
You must be signed in to change notification settings - Fork 893
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
feat(mongodb): Add pagination metadata to the aggregation results #6912
base: 4.1
Are you sure you want to change the base?
Conversation
} | ||
|
||
$resultsAggregationBuilderProphecy = $this->prophesize(Builder::class); | ||
$resultsAggregationBuilderProphecy->skip($expectedOffset)->shouldBeCalled()->willReturn($skipProphecy->reveal()); | ||
|
||
$addFieldsProphecy = $this->prophesize(AddFields::class); |
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.
@alcaeus The class Doctrine\ODM\MongoDB\Aggregation\Stage\AddFields
is final, it's impossible to mock. I had to duplicate it here.
I hate how this tests are mocking the full aggregation builder. It's very hard to read and to update. It should be refactored to use an actual MongoDB connection.
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.
I removed the duplicated class thanks to doctrine/mongodb-odm#2717.
public const LIMIT_ZERO_MARKER_FIELD = '___'; | ||
public const LIMIT_ZERO_MARKER = 'limit0'; |
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.
This constants are removed. They should have been marked as internal. We can keep them for backward compatibility, but they are useless now that they are not used in the aggregation pipeline.
aeb7cc3
to
eaa37fe
Compare
It looks like the patch is responsible for the failing CI |
b19b61c
to
4932f30
Compare
56c3a0e
to
adc939b
Compare
@@ -124,7 +124,7 @@ | |||
"doctrine/common": "^3.2.2", | |||
"doctrine/dbal": "^4.0", | |||
"doctrine/doctrine-bundle": "^2.11", | |||
"doctrine/mongodb-odm": "^2.6", | |||
"doctrine/mongodb-odm": "^2.9.2", |
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.
Required for mocking AddFields
. See release 2.9.2
Simplifies code by removing the need to extract
firstResult
andmaxResults
from the pipeline, by adding a$setFields
stage to add the litteral informations.This also remove references to the MongoDB
Cursor
and theUnitOfWork
stored in thePaginator
class. I hope this helps preventing memory leak issues.Since I'm modifying the aggregation pipeline, the parameters of the
Paginator
constructor and deleting 2 constants from thePaginator
class, it's best not to merge this as a bugfix.