zend-frameworkzend-framework2zend-config

zend framework 2 autoload config in sub folder


On my [src/config/autoload], I have sub folders in them in which I want to autoload too. Example:

/src/config/autoload/forms/search.global.php
/src/config/autoload/development/features.global.php
/src/config/autoload/logger.global.php
/src/config/autoload/bridge.global.php

...

my application.config.php file:

return array(
      'module_listener_options' => array(
          'config_glob_paths' => array(
              'config/autoload/{,*.}{global,base}.php',
          )
      );

What is does is it just loads the logger.global.php and the bridge.global.php but not the one's in the subfolder.


Solution

  • They aren't loaded simply because you haven't specified the path. Try with this :

    return array(
      'module_listener_options' => array(
          'config_glob_paths' => array(
              'config/autoload/{,*.}{global,base}.php',
              'config/autoload/forms/{,*.}{global,base}.php',
              'config/autoload/development/{,*.}{global,base}.php',
          )
      );