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

Ajustement

parent f3b1e6c7
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -134,11 +134,13 @@ class ParametreService
            throw new ParametreNotFoundException("Aucun paramètre de trouvé pour les codes [Categorie: ".$categorieCode.",Parametre: ".$parametreCode."]");
        }

        if ($parametre->getValeur() === null) return null;

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

        // Note : attention en bd c'est un string du coup si === alors 'true'
        if ($parametre->getValeursPossibles() === Parametre::TYPE_BOOLEAN && $parametre->getValeur() !== null)          return ($parametre->getValeur() === 'true');
        if ($parametre->getValeursPossibles() === Parametre::TYPE_NUMBER && $parametre->getValeur() !== null)           return ((int) $parametre->getValeur());
        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é");
    }