You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately none of the two builders implement a common Interface. But there is another reason why using a single adapter for both use cases could be problematic!
The aggregation builder uses a pipeline. Each time a so called "stage" e.g. limit oder sort is added the return value of the assigned variable changes.
The aggregation builder is a bit different from the query builder in terms of how it handles its data. I'm not sure which way I like better, but it seemed sensible to build it like this at the time. Either way, while this will store a reference to a query builder:
Since adding a stage to the builder modifies the builder instance, you'll want to create a clone of $this->aggregationBuilder in your getSlice method, otherwise you'll just end up with multiple conflicting $limit and $skip stages in your pipeline when retrieving multiple pages.
Also there are plans for ODM version 2 which may change this behaviour
Not sure where in that PR you saw that, but right now that sounds like news to me 😉
Currently the
DoctrineODMMongoDBAdapter
only supports the Query Builder:But there is also the Aggregation Builder:
Adding an additional adapter based on the existing one is actually easy:
Unfortunately none of the two builders implement a common Interface. But there is another reason why using a single adapter for both use cases could be problematic!
The aggregation builder uses a pipeline. Each time a so called "stage" e.g.
limit
odersort
is added the return value of the assigned variable changes.As soon as you pass a
Stage
instance you can not retrieve the original builder:Also there are plans for ODM version 2 which may change this behaviour:
Maybe @alcaeus or @malarzm could comment on this too? Thanks in advance!
Possibly related issues:
The text was updated successfully, but these errors were encountered: