I need to build dynamic multi level routing in zf2, but not sure what way to approach it. What i need is:
/listing[/:directory1[/:directory2[/dir...]] as unlimited nesting to mimic a directory structure.
Ideally all directories should come either as an array or at least a single variable like "directory1/directory2/directory3...".
i can not find anywhere ho to properly set up these parameters or even if zf2 supports that kind of routing. My current route config looks like this:
...
'gallery' => array(
'type' => 'Literal',
'options' => array(
'route' => '/Gallery',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Gallery',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'listing' => array(
'type' => 'Segment',
'options' => array(
'route' => '/listing[/:directory1[/:directory2]]',
'constraints' => array(
'directory1' => '[a-zA-Z][a-zA-Z0-9_-]*',
'directory2' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Listing',
'action' => 'index',
),
),
),
),
),
...