ZF2-117: Zend\Navigation\Container::addPages() should accept a Zend\NavigationContainer


This is the ZF2 version of ZF-9815

The addPages() method of Zend_Navigation_Container only takes an array or a Zend_Config instance. It should also accept a Zend_Navigation_Container.

It's a fairly minor fix. Insert the following into the addPages method:

if ($pages instanceof Zend_Navigation_Container) {
    $pages = iterator_to_array($pages);

The docblocks and exception message will also need updating. Note: this uses iterator_to_array instead of getPages so that the order of pages will be consistent with calling toArray().


Pull Request https://github.com/zendframework/zf2/pull/419 fixes this one, but can't be applied as Zend\Navigation needs refactoring to remove FrontController dependencies.

We have no more dependencies to the FronController: https://github.com/zendframework/zf2/…

Fixed with GH-708