Commit 0f2ff35a authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

...

parent e57f9afc
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+14 −2
Original line number Diff line number Diff line
@@ -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