Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -34,11 +34,17 @@ abstract class TableValidationHelper extends Helper ...@@ -34,11 +34,17 @@ abstract class TableValidationHelper extends Helper
*/ */
public function convertTableExistenceCheckResultToBoolean(array $result): bool 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"); 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 $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; return intval($value) === 1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment