ZF2-463: Zend\Navigation\Container::addPage does not inject RouteMatch or Router

Description

If you create a Zend\Navigation\Navigation using the DefaultNavigationFactory, the Router and RouteMatch are automatically injected into every MVC page.

However, if you subsequently add MVC pages to the Navigation using the Navigation::addPage method, the Router and RouteMatch are not injected for you. You can set a default router on Zend\Navigation\Page\Mvc, but you have to set the RouteMatch manually every time.

Would you please consider making one of the following modifications:

  1. Change Zend\Navigation\Page\Mvc so you can specify a default RouteMatch as well as a default Router.

  2. Change Zend\Navigation\AbstractContainer so that it automatically injects the Router and RouteMatch on every call to addPage.

Many thanks!

Comments

I think your first suggestion is a good idea.

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2525