Symfony 4: Command-Syntax to call Process Component

  asynchronous, command, process, symfony, symfony4

I have created a symfony command that can be executed successful from the shell using the following syntax:

php bin/console app:create-pdf 1

this command works! (the last two parameters are required for the command to process)
Now I want to call this command inside my Controller using the Process Component, but I have trouble to pass the correct parameters to get things working, when I call the constructor.

 $phpBinaryFinder = new PhpExecutableFinder();
    $phpBinaryPath = $phpBinaryFinder->find();
    $projectRoot = $this->getParameter('kernel.project_dir');

    $process = new Process([$phpBinaryPath, $projectRoot . '/bin/console', 'app:create-pdf', $registration->getId(), $imageUrl]);

My $phpBinaryPath is = “C:xamppphpphp-cgi.exe” using xampp on windows.
My $projectRoot is = “C:Webprojekte2019projectX”

This code snippet is “inspired” by this guide

Source: Symfony Questions