Closed orangevinz closed 6 months ago
You could do something like this :
final class ProfileDTO
{
public string $name;
#[MapTo(target: Profile::class, name: 'jobTitle', transformer: 'source.job ? source.job.title : null')]
#[MapTo(target: Profile::class, name: 'jobCompany', transformer: 'source.job ? source.job.company : null')]
#[ApiProperty(description: 'Job information.')]
public ?JobDTO $job = null;
}
Ok got it. Thanks
Is it possible to transform an object/DTO to multiple target attributes ?
Source: