Fix formattazione API per App

This commit is contained in:
Dasc3er 2021-09-17 12:51:43 +02:00
parent 5e6938da50
commit 5137f43631
1 changed files with 25 additions and 1 deletions

View File

@ -95,7 +95,7 @@ class Intervento extends Resource implements UpdateInterface
$this->importaRecords($key, $records);
}
return $this->response;
return $this->forceToString($this->response);
}
/**
@ -176,4 +176,28 @@ class Intervento extends Resource implements UpdateInterface
return true;
}
/**
* Converte i valori numerici in stringhe.
*
* @param $list
*
* @return array
*/
protected function forceToString($list)
{
$result = [];
// Fix per la gestione dei contenuti numerici
foreach ($list as $key => $value) {
if (is_numeric($value)) {
$result[$key] = (string) $value;
} elseif (is_array($value)) {
$result[$key] = $this->forceToString($value);
} else {
$result[$key] = $value;
}
}
return $result;
}
}