doctrine / mongodb

PHP MongoDB Abstraction Layer

Home Page:https://www.doctrine-project.org/projects/mongodb.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EagerCursor does not support sorting

alcaeus opened this issue · comments

The Doctrine\MongoDB\EagerCursor class wraps Doctrine\MongoDB\Cursor, but does not offer methods like sort(). Instead, they must be called using $eagerCursor->getCursor()->sort(). While this works, it also means that the two cursor classes are not interchangeable.
Note: this trickles down to the ODM as well, since the ODM\EagerCursor class also does not support sorting which in turn causes other errors. IMO, the EagerCursor class should also offer the sort methods.

Ping @jmikola Any feedback on this one?

There should be an interface for that.

For the record: ODM for now has a "quickfix" unwrapping EagerCusror. I agree that common interface would be nice and should land here :)

I agree. I assume this interface should probably offer all methods that MongoCursor offers?

The PR contains a common interface - feedback is greatly appreciated!

Will try to take a look in the next couple of days.

Closing this to consolidate discussion in #209.