I'm looking for a working solution, to iterate over a mongodb PersistentCollection in symfony2. Unfortunately this seems not to work? Symfony ignores the next() function!
while (($animal = $zooAnimals->next()) !== false) {
$color = $animal->getColor();
print_r($color); die; // Test and die
}
print_r('Where are the animals?'); die; // << Current result
Reference: Doctrine\ODM\MongoDB\PersistentCollection