Simple example of using child routes, using the Segment type, to keep a routing table in Zend Framework 2 simple and compact. For more information, check out http://www.masterzendframework.com/tutorial/child-and-segment-routes.
return array( | |
'router' => array( | |
'routes' => array( | |
'forecaster' => array( | |
'type' => 'Literal', | |
'options' => array( | |
'route' => '/forecaster', | |
'defaults' => array( | |
'__NAMESPACE__' => 'Forecaster\Controller', | |
'controller' => 'Forecaster', | |
'action' => 'index', | |
), | |
), | |
'may_terminate' => true, | |
'child_routes' => array( | |
'earnings-period' => array( | |
'type' => 'segment', | |
'options' => array( | |
'route' => '/earnings/[:period]/[:type]', | |
'constraints' => array( | |
'period' => '(this|previous|last|next|current)', | |
'type' => '(week|month|quarter|year)' | |
), | |
'defaults' => array( | |
'controller' => 'earnings', | |
'action' => 'view' | |
) | |
) | |
), | |
'pipeline-period' => array( | |
'type' => 'segment', | |
'options' => array( | |
'route' => '/pipeline/[:period]/[:type]', | |
'constraints' => array( | |
'period' => '(this|previous|last|next|current)', | |
'type' => '(week|month|quarter|year)' | |
), | |
'defaults' => array( | |
'controller' => 'pipeline', | |
'action' => 'view' | |
) | |
) | |
), | |
), | |
), | |
), | |
), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment