4040
4141class TaskController extends Controller
4242{
43- public function __construct (
44- protected ProcessExecutionRawRepository $ processExecutionRaw ,
45- ) {
46- }
47-
4843 use TaskControllerIndexMethods;
4944
45+ private function processExecutionRaw (): ProcessExecutionRawRepository
46+ {
47+ return app (ProcessExecutionRawRepository::class);
48+ }
49+
5050 /**
5151 * A whitelist of attributes that should not be
5252 * sanitized by our SanitizeInput middleware.
@@ -343,7 +343,7 @@ public function show(ProcessRequestToken $task)
343343 public function update (Request $ request , ProcessRequestToken $ task )
344344 {
345345 if (!$ task ->relationLoaded ('process ' )) {
346- $ task ->setRelation ('process ' , $ this ->processExecutionRaw ->getProcessForAuthorizeRaw ($ task ->process_id ));
346+ $ task ->setRelation ('process ' , $ this ->processExecutionRaw () ->getProcessForAuthorizeRaw ($ task ->process_id ));
347347 }
348348 $ this ->authorize ('update ' , $ task );
349349 if ($ request ->input ('status ' ) === 'COMPLETED ' ) {
@@ -352,39 +352,39 @@ public function update(Request $request, ProcessRequestToken $task)
352352 }
353353 // Skip ConvertEmptyStringsToNull and TrimStrings middlewares
354354 $ data = json_optimize_decode ($ request ->getContent (), true );
355- $ requestRow = $ this ->processExecutionRaw ->getProcessRequestRowForCompleteRaw ($ task ->process_request_id );
356- $ data = SanitizeHelper::sanitizeData ($ data ['data ' ], null , $ this ->processExecutionRaw ->getDoNotSanitizeFromRowRaw ($ requestRow ));
355+ $ requestRow = $ this ->processExecutionRaw () ->getProcessRequestRowForCompleteRaw ($ task ->process_request_id );
356+ $ data = SanitizeHelper::sanitizeData ($ data ['data ' ], null , $ this ->processExecutionRaw () ->getDoNotSanitizeFromRowRaw ($ requestRow ));
357357
358358 //Call the manager to trigger the start event
359- $ process = $ this ->processExecutionRaw ->getProcessForCompleteRaw ($ task ->process_id );
360- $ instance = $ this ->processExecutionRaw ->getProcessRequestFromRowRaw ($ requestRow );
359+ $ process = $ this ->processExecutionRaw () ->getProcessForCompleteRaw ($ task ->process_id );
360+ $ instance = $ this ->processExecutionRaw () ->getProcessRequestFromRowRaw ($ requestRow );
361361 $ instance ->setRelation ('process ' , $ process );
362- if ($ processVersion = $ this ->processExecutionRaw ->getProcessVersionForCompleteRaw ($ requestRow ->process_version_id ?? null )) {
362+ if ($ processVersion = $ this ->processExecutionRaw () ->getProcessVersionForCompleteRaw ($ requestRow ->process_version_id ?? null )) {
363363 $ instance ->setRelation ('processVersion ' , $ processVersion );
364364 }
365365 $ task ->setRelation ('processRequest ' , $ instance );
366366 $ task ->setRelation ('process ' , $ process );
367367
368- if ($ this ->processExecutionRaw ->taskHasDraftRaw ($ task ->id )) {
368+ if ($ this ->processExecutionRaw () ->taskHasDraftRaw ($ task ->id )) {
369369 TaskDraft::moveDraftFiles ($ task );
370370 }
371371
372372 WorkflowManager::completeTask ($ process , $ instance , $ task , $ data );
373373
374- $ responseInstance = $ this ->processExecutionRaw ->getProcessRequestForResponseRaw ($ task ->process_request_id );
374+ $ responseInstance = $ this ->processExecutionRaw () ->getProcessRequestForResponseRaw ($ task ->process_request_id );
375375 $ responseInstance ->setRelation ('process ' , $ process );
376- $ taskRefreshed = $ this ->processExecutionRaw ->refreshTaskRaw ($ task , $ process , $ responseInstance );
376+ $ taskRefreshed = $ this ->processExecutionRaw () ->refreshTaskRaw ($ task , $ process , $ responseInstance );
377377
378378 return new Resource ($ taskRefreshed );
379379 } elseif (!empty ($ request ->input ('user_id ' ))) {
380- $ process = $ this ->processExecutionRaw ->getProcessForReassignRaw ($ task ->process_id );
380+ $ process = $ this ->processExecutionRaw () ->getProcessForReassignRaw ($ task ->process_id );
381381 $ task ->setRelation ('process ' , $ process );
382382
383383 $ userToAssign = $ request ->input ('user_id ' );
384384 $ comments = $ request ->input ('comments ' );
385385 $ task ->reassign ($ userToAssign , $ request ->user (), $ comments );
386386
387- $ taskRefreshed = $ this ->processExecutionRaw ->refreshTaskRaw ($ task , $ process , $ task ->processRequest );
387+ $ taskRefreshed = $ this ->processExecutionRaw () ->refreshTaskRaw ($ task , $ process , $ task ->processRequest );
388388 CaseUpdate::dispatchSync ($ task ->processRequest , $ taskRefreshed );
389389
390390 return new Resource ($ taskRefreshed );
0 commit comments