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

微笑、不失礼 提交于 2019-12-10 16:39:26

问题


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.


回答1:


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',
                    ),
                ),
            )
        )
    )
);


来源:https://stackoverflow.com/questions/12621177/zend-2-how-to-override-modules-configuration-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!