You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use the new ObjectMapper (https://symfony.com/doc/current/object_mapper.html) to map an Entity that has an array of another entity as its members to a Dto.
Following is an example of the Entity and the Dto.
the resulting $exerciseResultDto's member is CoordinationComponentResult[] instead of CoordinationComponentResultDto[].
I'd assume the solution would look something like
#[Map(source: 'coordinationComponentResults.toArray', target: CoordinationComponentResultDto::class . '[]' )]
public array $coordinationComponentResults;
But this does not work either.
How can one map a nested array members to their Dto counterpart?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to use the new ObjectMapper (https://symfony.com/doc/current/object_mapper.html) to map an Entity that has an array of another entity as its members to a Dto.
Following is an example of the Entity and the Dto.
When mapping the Entity to its Dto
the resulting
$exerciseResultDto
's member isCoordinationComponentResult[]
instead ofCoordinationComponentResultDto[]
.I'd assume the solution would look something like
But this does not work either.
How can one map a nested array members to their Dto counterpart?
Beta Was this translation helpful? Give feedback.
All reactions