Reputation: 14856
I followed the guideline on how to expose a semantic configuration for a bundle and configured it in my app/config.yml
(through parameters.yml
).
My bundle also contains some console commands. Right now this command either uses the dev or prod configuration, which is fine.
But how can I make the console commands use an additional configuration file that sets some things different than in config.yml
?
E.g.
#app/config.yml
imports:
- { resource: parameters.yml }
foo:
view_mode: %view_mode%
and
#app/parameters.yml
parameters:
view_mode: 1
How can I make it e.g. use a different parameters.yml
#app/parameters_console.yml
parameters:
view_mode: 2
when called through the console? A new environment is not what I want here.
Upvotes: 2
Views: 1155
Reputation: 7525
I think you need to create a custom environement
You just have to create a config_console.yml
in your app/config
folder and override the configuration you need.
imports:
- { resource: config_dev.yml }
foo:
view_mode: 2
Then in your application, just run
php app/console --env=console
This will run your application with default configuration of dev
and with foo.view_mode = 2
You may want to note that it will create a new cache folder named console
Upvotes: 3