Symfony2命令运行缓存:clear -e prod

时间:2014-10-30 12:50:06

标签: symfony command

我正在尝试编写运行其他命令的symfony2命令。 但是当我跑步时

$this->getApplication()->find('cache:clear')->run(new ArrayInput(array(
    'command' => 'cache:clear',
    '-e' => 'prod'
)), $output);
$output->writeln('Done clearing cache prod!');

它忽略了'-e'=> 'prod'参数给出:

Clearing the cache for the dev environment with debug true

而不是:

Clearing the cache for the prod environment with debug false

1 个答案:

答案 0 :(得分:0)

尝试删除'command' => 'cache:clear',,因为您已经在应用程序中找到的命令上运行,因此您无需再次指定它。

$this->getApplication()->find('cache:clear')->run(new ArrayInput(array(
    '-e' => 'prod'
)), $output);
相关问题