I’ve been looking for information on this question but the only answer I can find is by looking at how other modules take care of this. So far, I have seen this:
With CdliTwoStageSignup in Module.php
'factories' => array(
.
.
'cdlitwostagesignup_module_options' => function($sm) {
$config = $sm->get('Configuration');
return new Options\ModuleOptions($config['cdli-twostagesignup']);
},
.
}
With ZfcUser in Module.php
'factories' => array(
'zfcuser_module_options' => function ($sm) {
$config = $sm->get('Config');
return new Options\ModuleOptions(isset($config['zfcuser']) ? $config['zfcuser'] : array());
},
Based on Zend 2 documentation, ModuleManager Merges all the module.config.php of each module and is set in the service manager. Also, config files in .config/autoload directory can override the module config files.
To access the configurations, these two modules seem to use the keywords: “Config” and “Configuration”.
- Are these always the the keywords used with the service manager to get to config files?
- Is there any difference between choosing one over the other?
Appreciate any answer you can provide.
The keywork used should be
config. Internally, afaik, all key, aliases, etc.. will be turned from CamelCase to dash-separated-lowercase. SoConfigequalsconfigas far as configuration is concerned.Now when it comes down to
configurationvs.configi assumeconfigurationwas left available as an alias toconfig. At one point, i think beta 4 or beta 5 they’ve decided that all occurences ofconfigurationwill be replaced by the well known abbreviated form ofconfig. If ever there is any occurence ofconfigurationthat not acts as a fallback toconfigall community will appreciate you opening an issue on github to get it fixed.