zendframework/zf2 — pull request #4095 by adamlundrigan (2013-03-22 16:28:16+00:00)
Title: Zend\Navigation\Page\Mvc::getHref does not use RouteMatch parameters

The MVC page type in Navigation does not pull matched parameters from the provided RouteMatch object, which results in an error when using the breadcrumbs view helper:

```
Fatal error: Zend\Mvc\Router\Exception\InvalidArgumentException: Missing parameter "school" in /library/Zend/View/Helper/Navigation/AbstractHelper.php on line 466
```

My route hierarchy:
```
'router' => array(
'routes' => array(
'registration' => array(
'type' => 'Literal',
'options' => array(
'route' => '/registration',
'defaults' => array(
'controller' => 'CdliPortal\Controller\Registration\Dashboard',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'school' => array(
'type' => 'Segment',
'options' => array(
'route' => '/school/:school',
'constraints' => array(
'school' => '[0-9]+',
),
'defaults' => array(
'controller' => 'CdliPortal\Controller\Registration\School\Dashboard',
'action' => 'index',
),
),
),
),
),
),
),
```

The simplest fix i've found is to change `Zend\Navigation\Page\Mvc::getHref` to use the parameters from the RouteMatch object (if they are set) as the defaults and then merge the parameters set directly on the `Zend\Navigation\Page\Mvc` into that:

```
if ($this->getRouteMatch() !== null) {
$params = array_merge($this->getRouteMatch()->getParams(), $this->getParams());
} else {
$params = $this->getParams();
}
```

Though I am not 100% certain this is a comprehensive fix, or that it doesn't break / cause unexpected results with the other navigation view helpers (my application only uses bredcrumbs currently)