fix: ensure unique services mapping when creating api payload

This commit is contained in:
Björn Fromme
2026-03-16 12:02:28 +01:00
parent 875943e4da
commit baa4609102
3 changed files with 24 additions and 14 deletions
+3 -1
View File
@@ -461,10 +461,12 @@ class BookingEditDraftService
private function resolveServiceArray(array $serviceIds, array $services): array
{
$resolved = [];
$addedIds = [];
foreach ($serviceIds as $serviceId) {
if (isset($services[$serviceId])) {
if (isset($services[$serviceId]) && false === isset($addedIds[$serviceId])) {
$resolved[] = $services[$serviceId];
$addedIds[$serviceId] = true;
}
}
@@ -126,6 +126,7 @@ class BookingFingerprintService
private function normalizeServiceArray(array $services): array
{
$ids = array_map(fn ($s) => $s->id, $services);
$ids = array_unique($ids);
sort($ids);
return array_values($ids);