Would it be possible to add an option to a MongoCollection to allow
for the ability to pass in the class name of a class that extends
MongoCursor, so that it gets returned instead of the base MongoCursor?
> On Feb 13, 5:42 pm, Blake Stovall <bstov...@bstovall.com> wrote:
> > On Feb 13, 4:24 am, Ben Becker <benjamin.bec...@gmail.com> wrote:
> >
> > > On Feb 9, 9:24 pm, Blake Stovall <bstov...@bstovall.com> wrote:
> >
> > > > I'd like to extend MongoCursor to override a couple of methods and add
> > > > some minor functionality.
> >
> > > For this use case, would it be possible to use PHP's methods like
> > > __call() and __callStatic() to return the wrapper (ala multiple
> > > dispatch)? Something like:
> >
> > Well, it addresses another problem, but not the one the functionality
> > I asked about solves.
>
> I take that back. The same concept could be used in the ResultSet
> class to redirect some calls to the ResultSet class and passing the
> others through to the MongoCursor class. It's still a hacked solution
> compared to being able to extend a class directly (as are most
> solutions that utilize __get, __set, and __call).
Yeah, and it is also slower because it incurs calling yet another PHP
function.
cheers,
Derick
--
http://mongodb.org | http://derickrethans.nl
twitter: @derickr and @mongodb