Commit 9537296e authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

[FIX] Correction format de résultat non prévu dans...

[FIX] Correction format de résultat non prévu dans TableValidationHelper::convertTableExistenceCheckResultToBoolean()
parent 9ab2ea34
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -34,11 +34,17 @@ abstract class TableValidationHelper extends Helper
     */
    public function convertTableExistenceCheckResultToBoolean(array $result): bool
    {
        if (! isset($result[0])) {
        if (! isset($result[0]) && !isset($result['table_exists']) && !isset($result['TABLE_EXISTS'])) {
            throw new HelperException("Données fournies non exploitables");
        }

        $value = false;
        if (isset($result[0])) {
            $value = array_pop($result[0]); // NB: on ignore le nom de la colonne car la casse est incertaine
        }
        if (isset($result['table_exists']) || isset($result['TABLE_EXISTS'])) {
            $value = $result['table_exists'] ?? $result['TABLE_EXISTS'];
        }

        return intval($value) === 1;
    }