I'm looking for a **working solution**, to iterate over a [mongodb](/questions/tagged/mongodb "show questions tagged 'mongodb'") `PersistentCollection` in [symfony2](/questions/tagged/symfony2 "show questions tagged '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](http://www.doctrine-project.org/api/mongodb_odm/1.0/class-Doctrine.ODM.MongoDB.PersistentCollection.html)