From c8851a8e8a3b29ae0587986470220227849af7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 25 Apr 2025 17:28:57 +0200 Subject: [PATCH] Handle empty array case in denormalizeDoctrineEntity method Previously, the method did not explicitly handle empty arrays, which could lead to unexpected behavior. This update ensures that when an empty array is provided as an ID, an empty array is returned immediately. --- .../ChillMainBundle/Export/ExportDataNormalizerTrait.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php b/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php index 483e12cf8..147b5844f 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php +++ b/src/Bundle/ChillMainBundle/Export/ExportDataNormalizerTrait.php @@ -55,6 +55,10 @@ trait ExportDataNormalizerTrait private function denormalizeDoctrineEntity(array|int|string $id, ObjectRepository $repository): object|array { if (is_array($id)) { + if ([] === $id) { + return []; + } + return $repository->findBy(['id' => $id]); }