Loading src/UnicaenAutoform/Entity/Db/Formulaire.php +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ class Formulaire implements HistoriqueAwareInterface { $champs = []; foreach ($this->getCategories() as $categorie) { foreach ($categorie->getChamps() as $champ) { $champs[] = $champ; $champs[$champ->getId()] = $champ; } } return $champs; Loading src/UnicaenAutoform/Service/Formulaire/FormulaireReponseService.php +14 −2 Original line number Diff line number Diff line Loading @@ -319,8 +319,20 @@ class FormulaireReponseService } } public function setFormulaireReponse(FormulaireInstance $instance, int $champId, string $value): void { $champ = $instance->getFormulaire()->getChamps()[$champId]; /** @var FormulaireReponse $reponse */ $reponse = $instance->getReponseFor($champ); if ($reponse) $reponse->setReponse($value); else { $reponse = new FormulaireReponse(); $reponse->setFormulaireInstance($instance); $reponse->setChamp($champ); $reponse->setReponse($value); $this->create($reponse); } } } No newline at end of file Loading
src/UnicaenAutoform/Entity/Db/Formulaire.php +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ class Formulaire implements HistoriqueAwareInterface { $champs = []; foreach ($this->getCategories() as $categorie) { foreach ($categorie->getChamps() as $champ) { $champs[] = $champ; $champs[$champ->getId()] = $champ; } } return $champs; Loading
src/UnicaenAutoform/Service/Formulaire/FormulaireReponseService.php +14 −2 Original line number Diff line number Diff line Loading @@ -319,8 +319,20 @@ class FormulaireReponseService } } public function setFormulaireReponse(FormulaireInstance $instance, int $champId, string $value): void { $champ = $instance->getFormulaire()->getChamps()[$champId]; /** @var FormulaireReponse $reponse */ $reponse = $instance->getReponseFor($champ); if ($reponse) $reponse->setReponse($value); else { $reponse = new FormulaireReponse(); $reponse->setFormulaireInstance($instance); $reponse->setChamp($champ); $reponse->setReponse($value); $this->create($reponse); } } } No newline at end of file