Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: invalidation demandes sur modification de réponse != submit #15

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions backend/src/State/Reponse/ReponseProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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();
Expand All @@ -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));
Expand Down