Question

Possible Duplicate:
Zend Framework 2 MVC - Modules Route mapping not working

My router was working in beta4 but isn't working in beta5.

Needed is Locale in url. Option is namespace/module in url.

In module.config.php

return array(
        'router' => array(
            'routes' => array(
                'default' => array(
                    'type' => 'Zend\Mvc\Router\Http\Segment',
                    'options' => array(
                        'route' => '/[:locale[/:namespace[/:controller[/:action]]]]',
                        'constraints' => array(
                            'locale' => '[a-z]{2}_[A-Z]{2}',
                            'namespace' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        ),
                        'defaults' => array(
                            'locale' => 'da_DK',
                            'namespace' => 'Application',
                            'controller' => 'index',
                            'action' => 'index',
                        ),
                    ),
                ),
            ), ),
        'controller' => array(
            'classes' => array(
                'index' => 'Application\Controller\IndexController'
            ),
        ), 
            ......
    )
Was it helpful?

Solution

They did some changes, so it's the controller-part that doesn't work. It has changed name to controllers (with an s), and instead of classes it should be invokables now.

So try:

'controllers' => array(
            'invokables' => array(
                'index' => 'Application\Controller\IndexController'
            ),
), 

Edit: if this fixed the issue, we actually have a similar question here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top