Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend 2: How to override module's configuration file?

How can I override configuration files found under ./vendor/.../module_name/config/module.config.php?

And no, this link isn't working for me. I'm not sure why.

like image 505
Tool Avatar asked Feb 20 '23 01:02

Tool


1 Answers

Try naming the configuration file filename.global.php or filename.local.php.

Inside application.config.php it has this line:

config/autoload/{,*.}{global,local}.php

With regards to ZfcUser module and changing the main route.

In zfcuser.global.php modify the following at the bottom of the file:

return array(
    'zfcuser' => $settings,
    'service_manager' => array(
        'aliases' => array(
            'zfcuser_zend_db_adapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Zend\Db\Adapter\Adapter',
        ),
    ),
    'router' => array(
        'routes' => array(
            'zfcuser' => array(
                'options' => array(
                    'route' => '/member',
                    'defaults' => array(
                        'controller' => 'zfcuser',
                        'action' => 'index',
                    ),
                ),
            )
        )
    )
);
like image 163
DrBeza Avatar answered Feb 26 '23 02:02

DrBeza