0
Symfony로 처음으로 커스터마이징 된 커맨드를 만들려고합니다. 이 명령은 한 번에 3 개의 명령을 실행해야합니다.Symfony 커스터마이즈 된 커맨드가 최초 실행 후 멈춤
이 내 명령 클래스
class DoctrineFullFixturesLoadCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('doctrine:full-fixtures:load')
->setDescription('...')
->addArgument('argument', InputArgument::OPTIONAL, 'Argument description')
->addOption('option', null, InputOption::VALUE_NONE, 'Option description')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$argument = $input->getArgument('argument');
if ($input->getOption('option')) {
// ...
}
$arrCommands = [
[
'command' => 'doctrine:database:drop',
'--force' => true
], [
'command' => 'doctrine:database:create'
], [
'command' => 'doctrine:schema:update',
'--force' => true,
'--complete' => true
]
];
foreach ($arrCommands as $arrInput) {
$this->getApplication()->run(
new ArrayInput($arrInput),
$output
);
}
$output->writeln('Command result.');
}
}
문제는 때 반복 시작을 발생합니다. 실제로 세 줄 대신 첫 줄의 명령 만 실행됩니다. 어떤 이유에서든 첫 번째 명령을 실행 한 후에 반복이 멈춘 것처럼 보입니다. 실제로 이해할 수 없지만 실제로는 끝에있는 $output->writeln
의 메서드가 호출되지 않습니다.