1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-29 09:11:11 +01:00

Fix formattazione API per App

This commit is contained in:
Dasc3er 2021-09-17 12:51:43 +02:00
parent 5e6938da50
commit 5137f43631

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;
}
}