Here is my dump for route upon which i want to route my app.
[album] => Array([route] => Zend\Mvc\Router\Http\Segment Object
(
[parts:protected] => Array
(
[0] => Array
(
[0] => literal
[1] => /album
)
[1] => Array
(
[0] => optional
[1] => Array
(
[0] => Array
(
[0] => literal
[1] => /
)
[1] => Array
(
[0] => parameter
[1] => action
[2] =>
)
)
)
[2] => Array
(
[0] => optional
[1] => Array
(
[0] => Array
(
[0] => literal
[1] => /
)
[1] => Array
(
[0] => parameter
[1] => id
[2] =>
)
)
)
)
[regex:protected] => /album(?:/(?P[a-zA-Z][a-zA-Z0-9_-]*))?(?:/(?P[0-9]+))?
[paramMap:protected] => Array
(
[param1] => action
[param2] => id
)
[defaults:protected] => Array
(
[controller] => Album\Controller\Album
[action] => index
)
[assembledParams:protected] => Array
(
)
)
[priority] => 0
[serial] => 3
)
But when i try this
$router = $e->getRouter();
$url = $router->assemble(array(), array('name' => 'Album\index'));
i get following error.
Route with name "Album\index" not found
Edit: here is route settings from module.config
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
EDIT: As advised i made following changes
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album',
'constraints' => array(
'action' => 'index',
// 'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'process' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:action]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
),
),
but now i cant seem to pass index action. I mean the only action of album module visible to me is index and none else can some 1 correct/suggest what must be done?