From c43b5ca7d43f750de8f2b364c412be0eaf60f70f Mon Sep 17 00:00:00 2001 From: mrossard Date: Mon, 16 Dec 2024 10:17:00 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20invalidation=20demandes=20sur=20modifica?= =?UTF-8?q?tion=20de=20r=C3=A9ponse=20!=3D=20submit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/State/Reponse/ReponseProcessor.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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));