Skip to content

Commit 149d6e8

Browse files
committed
fix(symfony): explicitly set the target class when mapping entities to resources
1 parent d3b4b7b commit 149d6e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/State/Provider/ObjectMapperProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
6464
}
6565

6666
if ($data instanceof PaginatorInterface) {
67-
$data = new ArrayPaginator(array_map(fn ($v) => $this->objectMapper->map($v), iterator_to_array($data)), 0, \count($data));
67+
$data = new ArrayPaginator(array_map(fn ($v) => $this->objectMapper->map($v, $operation->getClass()), iterator_to_array($data)), 0, \count($data));
6868
} else {
69-
$data = $this->objectMapper->map($data);
69+
$data = $this->objectMapper->map($data, $operation->getClass());
7070
}
7171

7272
$request?->attributes->set('data', $data);

0 commit comments

Comments
 (0)