Find out which application and environment settings symfony task runs with
How to find out which application and environment settings my ta开发者_StackOverflow中文版sk runs with in symfony 1.4?
I believe you can't, but you can run your task per environment using one of the arguments.
I think this is because of the design of the task. For example, why would you want to run the generate:module
on just one environment? But obviously you will want to run cache:clear
on just development environment for example.
To use cache:clear
in just development environment, you can call it like this:
php symfony cache:clear --app="frontend" --env="dev" --type="all"
You can see the complete arguments of a task with:
php symfony help "task"
For example:
php symfony help cache:clear
The tasks built by you can also have the following options
protected function configure()
{
$this->addOptions(array(
new sfCommandOption('app', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', null),
new sfCommandOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'The environment', null)
));
$this->namespace = 'my';
$this->name = 'task';
$this->briefDescription = 'Thats my task';
}
protected function execute($arguments = array(), $options = array())
{
// get the values while executing the task
$application = $arguments['application'];
$environment = $arguments['env'];
}
精彩评论