2828#[Route(path: '/http/process/execute ' , name: 'http_process_execute ' , methods: ['POST ' ])]
2929class ProcessExecuteController extends AbstractController
3030{
31+ public function __construct (private readonly ValidatorInterface $ validator , private readonly MessageBusInterface $ bus , private readonly ProcessManager $ processManager )
32+ {
33+ }
34+
3135 public function __invoke (
3236 #[ValueResolver('http_process_execution ' )] HttpProcessExecution $ httpProcessExecution ,
33- ValidatorInterface $ validator ,
34- MessageBusInterface $ bus ,
35- ProcessManager $ processManager ,
3637 ): JsonResponse {
37- $ violations = $ validator ->validate ($ httpProcessExecution );
38+ $ violations = $ this -> validator ->validate ($ httpProcessExecution );
3839 if ($ violations ->count () > 0 ) {
3940 $ violationsMessages = [];
4041 foreach ($ violations as $ violation ) {
@@ -43,7 +44,7 @@ public function __invoke(
4344 throw new UnprocessableEntityHttpException (implode ('. ' , $ violationsMessages ));
4445 }
4546 if ($ httpProcessExecution ->queue ) {
46- $ bus ->dispatch (
47+ $ this -> bus ->dispatch (
4748 new ProcessExecuteMessage (
4849 $ httpProcessExecution ->code ?? '' ,
4950 $ httpProcessExecution ->input ,
@@ -56,7 +57,7 @@ public function __invoke(
5657 return new JsonResponse ('Process has been added to queue. It will start as soon as possible. ' );
5758 } else {
5859 try {
59- $ processManager ->execute (
60+ $ this -> processManager ->execute (
6061 $ httpProcessExecution ->code ?? '' ,
6162 $ httpProcessExecution ->input ,
6263 \is_string ($ httpProcessExecution ->context )
0 commit comments