I think the route cannot be matched in such case, since it hasn't an ending
delimiter. Your parts should not be optional for such a route to work.

Marco Pivetta

http://twitter.com/Ocramius

http://marco-pivetta.com



On 21 August 2012 12:17, Ralf Eggert <[email protected]> wrote:

> Hi Marco,
>
> > I think you can use a wildcard route (
> >
> https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/Router/Http/Wildcard.php
> )
> > as a child route of `/lang/module/controller/action/id/`.
>
> thanks for the hint, do you have an example? Or did I use it right here:
>
> ------------------------------------------------------------------------
> 'application' => array(
>     'type'    => 'segment',
>     'options' => array(
>         'route'    => '/[:lang][/:module][/:controller][/:action][/:id]',
>         'constraints' => array(
>             'lang'       => '[a-z]{2}',
>             'module'     => '[a-zA-Z][a-zA-Z0-9_-]*',
>             'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
>             'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
>             'id'         => '[0-9]+',
>         ),
>         'defaults' => array(
>             'module'     => 'Application',
>             'controller' => 'Application\Controller\Index',
>             'action'     => 'index',
>             'lang'       => 'de',
>         ),
>     ),
>     'may_terminate' => true,
>     'child_routes' => array(
>         'default' => array(
>             'type'    => 'Wildcard',
>             'options' => array(
>             ),
>         ),
>     ),
> ),
> ------------------------------------------------------------------------
>
> Anyway my route only works for these urls:
>
>   /de
>   /de/application
>
> When I add the controller part
>
>   /de/application/index
>
> I get an exception
>
>   The requested controller could not be mapped to an existing
>   controller class.
>   Controller:
>       index(resolves to invalid controller class or alias: index)
>
> I can fix this issue, when I change the controller definitions to:
>
>     'controllers' => array(
>         'invokables' => array(
>             'index' => 'Application\Controller\IndexController'
>         ),
>     ),
>
> But this would mean, that only my Application module can have an
> IndexController. Ok, maybe I could live with it somehow.
>
> But when it comes to the routing for a module, it fails.
>
>   /de/user
>   /de/news
>
> It always roots to the Application module but not to the expected modules.
>
> Does anyone have any idea for automated module detection?
>
> Regards,
>
> Ralf
>
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
>

Reply via email to