pfw*_*fwd 4 fixtures symfony doctrine-orm
doctrine:fixtures:load命令中的--no-interaction标志在Symfony命令中无法运行.它通过终端工作.我是在正确地说它?
当我从捆绑中运行时:
/**
* Loads the fixtures
* @param \Symfony\Component\Console\Output\OutputInterface $oOutput
* @return \Symfony\Component\Console\Output\OutputInterface
*/
protected function loadFixturesCommand($oOutput) {
$oOutput->writeln('<fg=white>Attempting to load fixtures</fg=white>');
$updateCommand = $this->getApplication()->find('doctrine:fixtures:load');
$updateArguments = array(
'command' => 'doctrine:fixtures:load',
'--no-interaction' => true,
);
$updateInput = new ArrayInput($updateArguments);
$updateCommand->run($updateInput, $oOutput);
try {
$updateCommand->run($updateInput, $oOutput);
} catch (ContextErrorException $e) {
//..
}
return $this;
}
Run Code Online (Sandbox Code Playgroud)
我被提示加载灯具
但运行这个:
php app/console doctrine:fixtures:load --no-interaction
Run Code Online (Sandbox Code Playgroud)
不提示我.
我究竟做错了什么?
pfw*_*fwd 15
我找到了解决方案.只需致电:
$input->setInteractive(false);
Run Code Online (Sandbox Code Playgroud)
像这样:
protected function loadFixturesCommand($oOutput) {
$oOutput->writeln('<fg=white>Attempting to load fixtures</fg=white>');
$updateCommand = $this->getApplication()->find('doctrine:fixtures:load');
$updateArguments = array(
'command' => 'doctrine:fixtures:load'
);
$updateInput = new ArrayInput($updateArguments);
$updateInput->setInteractive(false);
$updateCommand->run($updateInput, $oOutput);
try {
$updateCommand->run($updateInput, $oOutput);
} catch (ContextErrorException $e) {
//..
}
return $this;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3281 次 |
| 最近记录: |