phprouteszend-framework2zend-route

ZF2 route with prefix in not working for default


I want add crm as prefix of CRM module.

This is router section in my module.config.php

'router' => array(
        'routes' => array(          
            'calendar' => array(
                'type'    => 'segment',
                'options' => array(
                    'route'    => '/crm/calendar[/:action][/:id]',
                    'constraints' => array(
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ),
                    'defaults' => array(
                        'controller' => 'Crm\Controller\Calendar',
                        'action'     => 'index',
                    ),
                ),
            ),

When i use test.dev/crm/calendar/index is working properly. But it is not working for test.dev/crm/calendar . I couldn't find any issue.

When i use 'route' => '/calendar[/:action][/:id]', i can use test.dev/calendar. But i need use prefix. How can i do it?


Solution

  • Route configuration is correct. This route had over write from another module route. That's the issue. ZF2 has not easy way to check all routes and paths.