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

correction du cas booleen pour la methode getValeurForParametre

parent 18e4c9ea
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -167,8 +167,11 @@ class ParametreService
        if ($parametre === null) {
            throw new ParametreNotFoundException("Aucun paramètre de trouvé pour les codes [Categorie: ".$categorieCode.",Parametre: ".$parametreCode."]");
        }

        if ($parametre->getValeursPossibles() === Parametre::TYPE_STRING)           return $parametre->getValeur();
        if ($parametre->getValeursPossibles() === Parametre::TYPE_BOOLEAN)          return ($parametre->getValeur() === true);

        // Note : attention en bd c'est un string du coup si === alors 'true'
        if ($parametre->getValeursPossibles() === Parametre::TYPE_BOOLEAN)          return ($parametre->getValeur() === 'true');
        if ($parametre->getValeursPossibles() === Parametre::TYPE_NUMBER)           return ((int) $parametre->getValeur());

        throw new ParametreMalTypeException("Le type [".$parametre->getValeursPossibles()."] du paramètre [Categorie: ".$categorieCode.",Parametre: ".$parametreCode."] est non géré");