I need to run a command asynchronously. To do this, I'm trying to use Process Component.
The command I'm trying to start is calling a function that needs somes parameters. These parameters are given by Controller that launches the Process.
Problem is I don't know how to pass parameters to my command with Process Component.
Command :
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é.');
}
Controller :
$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();
Parameters I need to use are in ArrayInput but Process doesn't take array argument.