fix non hydrated EagerCursor. #424

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@jaypea

jaypea commented Oct 5, 2012

Map hydrate properties of EagerCursor to the same properties of its BaseCursor.
I was trying to speed some queries with this combination:
$qb = $this->doctrine->createQueryBuilder('collection_name')
->eagerCursor(true)
->hydrate(false);

It didn't work because the EagerCursor lost information about the hydration flag on its way.
This PR fixes this problem.

@@ -220,6 +220,7 @@ public function execute()
// Wrap odm cursor with EagerCursor if true
if ($this->query['eagerCursor'] === true) {
$results = new EagerCursor($results, $this->dm->getUnitOfWork(), $this->class);
+ $results->hydrate($this->hydrate);

This comment has been minimized.

@jmikola

jmikola Oct 5, 2012

Member

Can you fix the indentation here?

@jmikola

jmikola Oct 5, 2012

Member

Can you fix the indentation here?

@jmikola

This comment has been minimized.

Show comment
Hide comment
@jmikola

jmikola Oct 5, 2012

Member

@jwage: I took a look at the ODM and base Query classes, and am a bit confused as to why we have two EagerCursor classes. Is that purely to encapsulate the hydration logic?

The ODM's EagerCursor mentions extending the base class, although it really doesn't:

/**
 * EagerCursor extends the default Doctrine\MongoDB\EagerCursor implementation.
 *
 * @since       1.0
 * @author      Jonathan H. Wage <jonwage@gmail.com>
 */
class EagerCursor implements \Doctrine\MongoDB\Iterator

I'm mainly curious if there are other flags that should be copied over to the EagerCursor constructed in the ODM's Query class, or if the hydrate flag is all that's important. The base Query class already wraps the cursor with its EagerCursor implementation in Doctrine\MongoDB\Query::prepareCursor().

Member

jmikola commented Oct 5, 2012

@jwage: I took a look at the ODM and base Query classes, and am a bit confused as to why we have two EagerCursor classes. Is that purely to encapsulate the hydration logic?

The ODM's EagerCursor mentions extending the base class, although it really doesn't:

/**
 * EagerCursor extends the default Doctrine\MongoDB\EagerCursor implementation.
 *
 * @since       1.0
 * @author      Jonathan H. Wage <jonwage@gmail.com>
 */
class EagerCursor implements \Doctrine\MongoDB\Iterator

I'm mainly curious if there are other flags that should be copied over to the EagerCursor constructed in the ODM's Query class, or if the hydrate flag is all that's important. The base Query class already wraps the cursor with its EagerCursor implementation in Doctrine\MongoDB\Query::prepareCursor().

@jwage

This comment has been minimized.

Show comment
Hide comment
@jwage

jwage Oct 11, 2012

Member

@jmikola The hydrate flag is specific to the ODM. We should probably copy over the hints too.

Member

jwage commented Oct 11, 2012

@jmikola The hydrate flag is specific to the ODM. We should probably copy over the hints too.

@jmikola

This comment has been minimized.

Show comment
Hide comment
@jmikola

jmikola Apr 1, 2013

Member

Follow-up in #424.

Member

jmikola commented Apr 1, 2013

Follow-up in #424.

@jmikola jmikola closed this Apr 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment