【发布时间】:2016-12-24 09:45:57
【问题描述】:
我需要异步运行命令。为此,我正在尝试使用流程组件。
我试图启动的命令是调用一个需要一些参数的函数。这些参数由启动进程的控制器给出。
问题是我不知道如何使用 Process Component 将参数传递给我的命令。
命令:
protected function configure()
{
$this
->setName('generationpdf:classement')
->setDescription('Génère le PDF d\'un classement.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
ini_set('memory_limit','4000M');
$pdf = $this->imprimerAction();
$this->sendClassement($pdf);
$output->writeln('PDF envoyé.');
}
控制器:
$command = new PDFClassementCommand();
$input = new ArrayInput(array('id' => $id, 'errata' => $errata, 'precision' => $precision, 'group' => $group, 'logoAnnee' => $logoAnnee));
$output = new NullOutput();
$process = new Process($command);
$process->disableOutput();
$process->start();
我需要使用的参数在 ArrayInput 但 Process 不接受数组参数。
【问题讨论】:
标签: php asynchronous command symfony