mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +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:
parent
abdfe49c33
commit
c8851a8e8a
@ -55,6 +55,10 @@ trait ExportDataNormalizerTrait
|
|||||||
private function denormalizeDoctrineEntity(array|int|string $id, ObjectRepository $repository): object|array
|
private function denormalizeDoctrineEntity(array|int|string $id, ObjectRepository $repository): object|array
|
||||||
{
|
{
|
||||||
if (is_array($id)) {
|
if (is_array($id)) {
|
||||||
|
if ([] === $id) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return $repository->findBy(['id' => $id]);
|
return $repository->findBy(['id' => $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user