Issues

ZF-6345: Ability to get at Zend_Config object?

Description

It would be nice if you could get at the Zend_Config object that Zend_Application loads from within the bootstrap object. Seems a shame to have to load it twice.

Comments

You don't have to load it twice. Just do this:

\


  $config = new Zend_Config($application->getOptions());

You canĀ“t blindly use $application->getOptions(), because the Zend_Config object is convertet to an array and than gets passed to $application->setOptions(array $options). ALL array keys are converted to lowercase!

public function setOptions(array $options)
{
    $options = array_change_key_case($options, CASE_LOWER);

If you are using camelcase in you config you are lost....

This has just bitten me and is a right pain.

It only affects the toplevel keys though, so one workaround is to put all the rest of your configuration within a top level key such as "app".

This same issue is beign discussed here and a patch is beign analysed to see if its worth implementing, performance-wise.

After r17801 options are no longer stored with flattened keys, thus creating a Config File with the suggestion mentioned in the first comment is now a viable solution to the problem.


$config = new Zend_Config($application->getOptions());