From 5137f4363153bb38decfc59530d1d1fb9fa7cc82 Mon Sep 17 00:00:00 2001 From: Dasc3er Date: Fri, 17 Sep 2021 12:51:43 +0200 Subject: [PATCH] Fix formattazione API per App --- src/API/App/v1/Flash/Intervento.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/API/App/v1/Flash/Intervento.php b/src/API/App/v1/Flash/Intervento.php index 54138726c..056cf1f51 100644 --- a/src/API/App/v1/Flash/Intervento.php +++ b/src/API/App/v1/Flash/Intervento.php @@ -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; + } }