Issues

ZF-6719: Allow multiple configs

Description

Currently there is only one configuration file. It would be nice, if its possible to combine more.

An example: The prefered way is to set up the configuration under "configs/application.*". So there could be others, something like "configs/navigation.*", which would be the configuration for the navigation-resource-plugin. Or it will be the configuration for the module "navigation" and the config for the navigation-resource-plugin resist under "configs/resources/navigation.*"

One other possibility is, that a module can carry its own configuration at "modules/name/configs/bla.*". As mentioned in the project-structure-proposal [1] the modules mimic the default structure, so the "configs"-directory is included. This should be used somewhere... ;)

[1] http://framework.zend.com/wiki/display/…

Comments

What about using an array for the 'config' option:


$application = new Zend_Application(
    APPLICATION_ENV, 
    array(
        'config' => array (
            APPLICATION_PATH . '/configs/database.ini',
            APPLICATION_PATH . '/configs/application.ini'
        )
    )
);

and change the setOption method in Zend_Application from


        if (!empty($options['config'])) {
            $options = $this->mergeOptions($options, $this->_loadConfig($options['config']));
        }

to


        if (!empty($options['config'])) {
            if (is_array($options['config'])) {
                foreach ($options['config'] as $tmp){
                    $options = $this->mergeOptions($options, $this->_loadConfig($tmp));
                }
            } else {
                $options = $this->mergeOptions($options, $this->_loadConfig($options['config']));
            }
        }

Attached is my proposed patch, if this is accepted it would be only to the trunk as another change that was made with ZF-6811.

This has been fixed and will be part of 1.10 as ZF-6811 was put into place before and was flaged for 1.10 since it introduces a BC break.