diff --git a/Content/ContentTypeResolver/AccountSelectionResolver.php b/Content/ContentTypeResolver/AccountSelectionResolver.php index a79f6b1..b5643ec 100644 --- a/Content/ContentTypeResolver/AccountSelectionResolver.php +++ b/Content/ContentTypeResolver/AccountSelectionResolver.php @@ -58,6 +58,12 @@ public function resolve($data, PropertyInterface $property, string $locale, arra $content[] = $this->accountSerializer->serialize($account->getEntity(), $locale, $serializationContext); } + $ids = $property->getValue(); + $idPositions = \array_flip($ids); + \usort($content, function($a, $b) use ($idPositions) { + return $idPositions[$a['id']] - $idPositions[$b['id']]; + }); + return new ContentView($content, ['ids' => $data]); } } diff --git a/Content/ContentTypeResolver/ContactSelectionResolver.php b/Content/ContentTypeResolver/ContactSelectionResolver.php index c909ec4..fa9669c 100644 --- a/Content/ContentTypeResolver/ContactSelectionResolver.php +++ b/Content/ContentTypeResolver/ContactSelectionResolver.php @@ -58,6 +58,12 @@ public function resolve($data, PropertyInterface $property, string $locale, arra $content[] = $this->contactSerializer->serialize($contact->getEntity(), $locale, $serializationContext); } + $ids = $property->getValue(); + $idPositions = \array_flip($ids); + \usort($content, function($a, $b) use ($idPositions) { + return $idPositions[$a['id']] - $idPositions[$b['id']]; + }); + return new ContentView($content, ['ids' => $data]); } }