-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
executeQuery() methods can return a QueryResult, provided server communication is still performed so that exceptions can be raised if necessary (we don't want to reimplement the current MongoCursor model, which can exist without having talked to a server).
The QueryResult should implement IteratorAggregate, and allow the cursor class to be customized. Possible implementations of a cursor might be one that returns raw BSON objects, hydrated PHP classes, or associative arrays. We'll likely have a base Cursor class that can be extended (with a final, private constructor – since initialization should not be done in userland). QueryResult will need to provide some way to inject dependencies into a Cursor class (e.g. allow an init callback to be registered, so folks can call setter methods).
Consider implementing the same for CommandResult and its cursor interaction. CommandResult should likely also implement IteratorAggregate and return an iterator of one result (the entire command document) for commands that do not support cursor results.
- is related to
-
PHPC-29 Ability to use a custom MongoCursor class
- Closed