Reputation: 3812
I placed some custom configs in my config_prod.yml file like this:
store:
plugins:
installed: [abc]
Since SF2 will load and compile and cache, the config_prod.yml is actually loaded just once only. I wonder (without the need to do some custom coding to use setParameter to set my custom config values to the container, or to use my own method of caching the custom configs), how do I access these custom config values? Are they automatically cached and made available somehow?
Upvotes: 3
Views: 3010
Reputation: 36191
Everything you define in the parameters section will be accessible as a parameter:
parameters:
store:
plugins:
installed: [abc]
You can access your configuration by calling getParameter()
on the container:
$store = $container->getParameter('store');
If you want to have your own section in the configuration file:
store:
plugins:
installed: [abc]
you'll have to create an extension and expose a semantic configuration of your bundle.
In both cases container with all its configuration is compiled and stored in cache.
Read more:
Upvotes: 3