No, I think iterator to array is optimized internally and should be O(1) I suppose (not sure about it though)

Envoyé de mon iPhone

> Le 6 janv. 2014 à 19:43, Daniel Gimenes <notifications@github.com> a écrit :
> 
> In src/Rbac/Rbac.php:
> 
> >          }
> >  
> > -        $iteratorIterator = new RecursiveIteratorIterator($role, RecursiveIteratorIterator::SELF_FIRST);
> > +        $iterator = $this->traversalStrategy->traverseRoles($roles);
> This way you are traversing the collection twice, since iterator_to_array triggers traversal (I guess). So it becomes slower, but should solve the Doctrine collections incompatibility! 
> 
> What about do it in Rbac\Traversal\RecursiveRoleIterator::__construct()?
> 
> —
> Reply to this email directly or view it on GitHub.