mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
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.
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user