-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
Description
Description
We can have several job launcher in the same application.
We might want to rely on only one, and thus use the one configured to be autowired with the interface.
But we might also want to use different one based on some arbitrary decision.
But because of testing, we do not want to rely on the actual class name.
Example
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Yokai\Batch\Launcher\JobLauncherInterface;
class Controller extends AbstractController
{
public function action(
JobLauncherInterface $simpleJobLauncher,
JobLauncherInterface $consoleJobLauncher,
JobLauncherInterface $messengerJobLauncher,
): Response {
/...
}
}
I should receive
- in
$simpleJobLauncher
:Yokai\Batch\Launcher\SimpleJobLauncher
- in
$consoleJobLauncher
:Yokai\Batch\Bridge\Symfony\Console\RunCommandJobLauncher
- in
$messengerJobLauncher
:Yokai\Batch\Bridge\Symfony\Messenger\DispatchMessageJobLauncher