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