zendframework/zf2 — pull request #1676 by juriansluiman (2012-06-29 09:51: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.

**P.S.** everything is updated, PR should be safe to merge. Travis puts a build status "unknown" here below, but click to see that the builds are passing.

**P.P.S** the previous PR #1565 went terribly wrong when I tried to rebase my commits. I cherry-picked the commits from #1565 and put those in a new branch, created from a fresh master. It should be OK to merge now, tests pass.

[![Build Status](https://secure.travis-ci.org/juriansluiman/zf2.png?branch=feature/navigation-mvc-router2)](http://travis-ci.org/juriansluiman/zf2)