zendframework/zf2 — pull request #1565 by juriansluiman (2012-06-23 09:50:42+00:00)
Title: Replace Url view helper by Router

The `Url` view helper is depending on the `Router` to assemble urls. The use of the url view helper in `Zend\Navigation` adds an unnecessary dependency for `Zend\View`, where the mvc navigation page already depends on `Zend\Mvc\Router\Route\RouteInterface`. Replacing the url view helper by a router does not change any behavior in url assembling, and simplifies usage of navigation.

Using the url helper is also problematic for this use case: to inject automatically the `RouteMatch` into the helper, you set up a factory to inject the router and routematch ([example](https://github.com/juriansluiman/SlmCmfUtils/blob/master/Module.php#L33)). To get this working, you want to make sure the first usage of the view helper happens after routing, but navigation parsing can happen anywhere in the process (bootstrap or during an early route listener).

This will create complexity, as you have to have a factory for the url view helper to inject the router and a listener after the route event to inject the routematch. Using the router directly in the navigation solves this completely.

Tests are still depending on the url helper, I will update tests to reflect this change.