From 33b91f80365b6814d4772384354ab1f460f4d97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Voleman?= Date: Thu, 7 Dec 2023 21:57:45 +0100 Subject: [PATCH] Add ID to exposed data --- src/Entity/NRPZS/HealthcareService.php | 1 + src/Service/NRPZs/Syncers/HealthcareServiceSyncer.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Entity/NRPZS/HealthcareService.php b/src/Entity/NRPZS/HealthcareService.php index ad27009..f1c7fe7 100644 --- a/src/Entity/NRPZS/HealthcareService.php +++ b/src/Entity/NRPZS/HealthcareService.php @@ -139,6 +139,7 @@ public function setFacility(?HealthcareFacility $facility): HealthcareService public function serialize( ): array { return [ + 'id' => $this->id, 'careField' => $this->careField, 'careForm' => $this->careForm, 'careType' => $this->careType, diff --git a/src/Service/NRPZs/Syncers/HealthcareServiceSyncer.php b/src/Service/NRPZs/Syncers/HealthcareServiceSyncer.php index 6ae8663..6ab3d7b 100644 --- a/src/Service/NRPZs/Syncers/HealthcareServiceSyncer.php +++ b/src/Service/NRPZs/Syncers/HealthcareServiceSyncer.php @@ -22,7 +22,9 @@ protected function getRepository(): EntityRepository */ protected function handleRow(array $row, EntityRepository $repository): void { - $id = $row['ZdravotnickeZarizeniId']. '-' . md5($row['OborPece']); + + $id = hash('sha256',$row['ZdravotnickeZarizeniId'].$row['OborPece']); + $id = substr($id, 0, 16); $service = $repository->find($id); if ($service === null) {