My Zend Framework 2 application has a route definition that tries to mimic the default Zend Framework 1 route. It looks like this:
'router' => array( 'routes' => array( 'default' => array( 'type' => 'segment', 'options' => array( 'route' => '/[:controller[/:action]]', 'defaults' => array( '__NAMESPACE__' => 'Application\Controller', 'controller' => 'Index', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'wildcard' => array( 'type' => 'wildcard', ), ), ), ), ),
It exactly matches the routes, but I cannot collect routes with arbitrary parameters using the Url helper helper.
For example,
$this->url('default', array('controller' => 'test', 'action' => 'test', 'id' => 5));
leads to /test/test instead of /test/test/id/5 .
Does anyone know how to collect partial routes like this? Or is there a better way to get ZF1 style routes?
Blake
source share