DDC-309: ReflectionException when using AbstractQuery::iterate() #3864

Closed
doctrinebot opened this Issue Feb 9, 2010 · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user nicokaiser:

When I use two Queries and iterate() over the results, the second one fails with a PHP Fatal error (ReflectionException). It has a strange message ('Class does not exist').
This happens with any two different entities. The error seems to occur when next() is called (directly or via foreach) and the objects are being created.

$q = $em->createQuery('SELECT c FROM Entity\Country c');
$q->iterate()->next();

$q = $em->createQuery('SELECT u FROM Entity\User u');
$q->iterate()->next(); // FAILS

Entities:
http://pastie.org/816374

Example code:
http://pastie.org/816377

@doctrinebot

Comment created by @beberlei:

It seems IterableResult does not support two iterators at once, because it re-uses the hydrator for both queries - effectivly deleting the information from the previous query and destroying the call.

@doctrinebot

Comment created by @beberlei:

Suggested patch

@doctrinebot

Comment created by @beberlei:

Fixed! :)

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0-BETA1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment