-
-
Notifications
You must be signed in to change notification settings - Fork 190
Include all cursor methods in cursor interface #225
Conversation
👍 |
/** | ||
* Return the connection for this cursor. | ||
* | ||
* @deprecated 1.1 Will be removed for 2.0 |
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.
If this is deprecated, so we really want to add it to the interface?
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 was thinking no, until I saw that ODM\Cursor
exposes the method as well (where I wanted to use the same interface). If we leave it out of ODM we can remove it from the interface here, otherwise I'd leave it in. What's your opinion on this?
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.
As discussed, we can remove this from the interface and have ODM still provide the method in its Cursor class, but simply do $this->baseBursor->getCollection()->getDatabase()->getConnection();
c1d44c3
to
8eb2629
Compare
LGTM with the interface revisions. |
8eb2629
to
23f1b27
Compare
1f92bc8
to
2fc6120
Compare
This replaces a $useKeys constructor option for EagerCursor, allowing it to better support a wrapped CursorInterface. Additionally, we deprecate the Cursor::toArray() $useKeys argument. If omitted, toArray() will default to the Cursor's class option; otherwise, an explicit $useKeys argument may still override.
8259e8d
to
6f82cd4
Compare
This extends the common cursor interface introduced in #209 to include all methods currently available in the cursor. This makes the
Cursor
andEagerCursor
more interchangeable in ODM, allowing us to plug both classes intoODM\Cursor
once that has been adapted.The
hasNext
andgetNext
methods have to be simulated by advancing and rewinding the array pointer as well as checking if the cursor has started iterating.