Zend Framework

Allow multiple configs

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.8.1
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Application
  • Labels:
    None

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/ZFPROP/Zend+Framework+Default+Project+Structure+-+Wil+Sinclair

Issue Links

Activity

Hide
Christoph Ziegenberg added a comment -

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']));
            }
        }
Show
Christoph Ziegenberg added a comment - 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']));
            }
        }
Hide
Jon Whitcraft added a comment -

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.

Show
Jon Whitcraft added a comment - 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.
Hide
Jon Whitcraft added a comment -

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.

Show
Jon Whitcraft added a comment - 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.

People

Vote (2)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: