开发者

Find out which application and environment settings symfony task runs with

开发者 https://www.devze.com 2023-03-25 02:34 出处:网络
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 a

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'];

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号