有一个 QueryBuilder 结果
$query = $em->createQuery("SELECT....");
通过 iterate() 方法获取它们
http://doctrine-orm.readthedocs.org/en/2.0.x/reference/batch-processing.html
$objects = $query->iterate();
我现在能够
foreach ($objects as $object) {
$object = $object[0];
//do something..
$object->getObjectId();
...
}
但...
//after the iterate() call, before to foreach
echo sizeof($objects); //or count($objects);
//always "1", even if i have 10000 foreach loops
为什么以及如何解决?