diff --git a/backend/src/State/Reponse/ReponseProcessor.php b/backend/src/State/Reponse/ReponseProcessor.php index 589d0c0..aeb26ab 100644 --- a/backend/src/State/Reponse/ReponseProcessor.php +++ b/backend/src/State/Reponse/ReponseProcessor.php @@ -15,8 +15,8 @@ use ApiPlatform\Metadata\Operation; use ApiPlatform\State\ProcessorInterface; use App\ApiResource\Demande; -use App\ApiResource\Telechargement; use App\ApiResource\Reponse; +use App\ApiResource\Telechargement; use App\Entity\EtatDemande; use App\Entity\Question; use App\Message\EtatDemandeModifieMessage; @@ -55,10 +55,10 @@ public function __construct(private readonly ReponseRepository $reponseRep } /** - * @param Reponse $data + * @param Reponse $data * @param Operation $operation - * @param array $uriVariables - * @param array $context + * @param array $uriVariables + * @param array $context * @return Reponse * @throws Exception */ @@ -128,6 +128,7 @@ public function __construct(private readonly ReponseRepository $reponseRep /** * Est-ce qu'on a validé tout le questionnaire? */ + $demandeResource = $this->transformerService->transform($demande, Demande::class); if ($question->getTypeReponse() == Question::TYPE_SUBMIT) { //vérification faite en amont par ValidationDemandePossibleConstraintValidator $etatPrecedent = $demande->getEtat(); @@ -145,10 +146,11 @@ public function __construct(private readonly ReponseRepository $reponseRep ) ); - $demandeResource = $this->transformerService->transform($demande, Demande::class); - $this->messageBus->dispatch(new RessourceModifieeMessage($demandeResource)); } + //la demande doit être invalidée dans tous les cas - recalcul du champ 'complete" + $this->messageBus->dispatch(new RessourceModifieeMessage($demandeResource)); + $resource = $this->transformerService->transform($reponse, Reponse::class); if ($new) { $this->messageBus->dispatch(new RessourceModifieeMessage($resource));