这是根据documentation
进行的protected function execute(InputInterface $input, OutputInterface $output)
{
$command = $this->getApplication()->find('demo:greet');
$arguments = array(
'command' => 'demo:greet',
'name' => 'Fabien',
'--yell' => true,
);
$greetInput = new ArrayInput($arguments);
$returnCode = $command->run($greetInput, $output);
// ...
}
我想要做的是调用命令: “php app / console cjw:check-symlinks --vendor = Acme”
但它不起作用,这是代码:
$command = $this->getApplication()->find('cjw:check-symlinks');
$arguments = array(
'--vendor'=>'Jac',
);
$Input = new ArrayInput($arguments);
$returnCode = $command->run($Input, $output);
它会中断执行并抛出以下错误:
[RuntimeException]没有足够的参数。
答案 0 :(得分:2)
您需要提供所有参数。命令名称至少:
$command = $this->getApplication()->find('cjw:check-symlinks');
$arguments = array(
'command' => 'cjw:check-symlinks',
// other arguments, depending on cjw:check-symlinks definition
'--vendor'=>'Jac',
);
$Input = new ArrayInput($arguments);
$returnCode = $command->run($Input, $output);