[DDC-309] ReflectionException when using AbstractQuery::iterate() Created: 09/Feb/10  Updated: 09/Feb/10  Resolved: 09/Feb/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: 2.0-BETA1
Security Level: All

Type: Bug Priority: Blocker
Reporter: Nico Kaiser Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File ddc309.patch    


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 = $em->createQuery('SELECT u FROM Entity\User u');
$q->iterate()->next(); // FAILS


Example code:

Comment by Benjamin Eberlei [ 09/Feb/10 ]

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.

Comment by Benjamin Eberlei [ 09/Feb/10 ]

Suggested patch

Comment by Benjamin Eberlei [ 09/Feb/10 ]


Generated at Tue Nov 24 21:35:08 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.