php - Count Doctrine's iterate() Collection Result -
having querybuilder result
$query = $em->createquery("select....");
fetching them iterate() method
http://doctrine-orm.readthedocs.org/en/2.0.x/reference/batch-processing.html
$objects = $query->iterate();
i able to
foreach ($objects $object) { $object = $object[0]; //do something.. $object->getobjectid(); ... }
but...
//after iterate() call, before foreach echo sizeof($objects); //or count($objects); //always "1", if have 10000 foreach loops
why , how fix?
$query->iterate()
give iterator not countable. consider writing sec query count(result)
you, or utilize paginator
php doctrine doctrine2
No comments:
Post a Comment