Created
April 2, 2014 14:37
-
-
Save settermjd/9935478 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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