File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
lib/Doctrine/ODM/MongoDB/Aggregation Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 10
10
use Doctrine \ODM \MongoDB \Iterator \Iterator ;
11
11
use Doctrine \ODM \MongoDB \Iterator \UnrewindableIterator ;
12
12
use Doctrine \ODM \MongoDB \Mapping \ClassMetadata ;
13
+ use Iterator as SPLIterator ;
13
14
use IteratorAggregate ;
14
15
use MongoDB \Collection ;
15
- use MongoDB \Driver \Cursor ;
16
+ use MongoDB \Driver \CursorInterface ;
16
17
17
18
use function array_merge ;
18
19
use function assert ;
@@ -35,12 +36,14 @@ public function getIterator(): Iterator
35
36
$ options = array_merge ($ this ->options , ['cursor ' => true ]);
36
37
37
38
$ cursor = $ this ->collection ->aggregate ($ this ->pipeline , $ options );
38
- assert ($ cursor instanceof Cursor);
39
+ // This assertion can be dropped when requiring mongodb/mongodb 1.17.0
40
+ assert ($ cursor instanceof CursorInterface);
41
+ assert ($ cursor instanceof SPLIterator);
39
42
40
43
return $ this ->prepareIterator ($ cursor );
41
44
}
42
45
43
- private function prepareIterator (Cursor $ cursor ): Iterator
46
+ private function prepareIterator (CursorInterface & SPLIterator $ cursor ): Iterator
44
47
{
45
48
if ($ this ->classMetadata ) {
46
49
$ cursor = new HydratingIterator ($ cursor , $ this ->dm ->getUnitOfWork (), $ this ->classMetadata );
You can’t perform that action at this time.
0 commit comments