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
#[ORM\Entity(repositoryClass: TrackRepository::class)]
class Track
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int$id = null;
#[MapFrom(source: 'array', property: 'track.uri')] // tested with [track][uri] like PropertyAccessor
#[ORM\Column(length: 100)]
private ?string$uri = null;
// ... other properties and methods
}
Issue
Currently, when attempting to map the nested track.uri property to the Track entity's uri property, the generated mapping does not appear to handle nested properties as expected. The generated code is:
You should indeed use a transformer for that, we don't want to do property interpolation here, some api may provide a dot in their property name (weird but already seen it).
I keep this open as we should certainly provide a documentation about how to do this (not the first time it is asked)
Description
I would like to map using nested properties for array to object mapping in the current implementation.
Example
Given an input array:
And the following entity definition:
Issue
Currently, when attempting to map the nested
track.uri
property to theTrack
entity'suri
property, the generated mapping does not appear to handle nested properties as expected. The generated code is:The code attempts to access
track.uri
as a single key in the array, instead of navigating through the nested structure.Expected Behavior
The mapping should properly navigate the nested array structure and map the
track.uri
value to theuri
property of theTrack
entity. For instance:Questions
The text was updated successfully, but these errors were encountered: