8000 [ObjectMapper] Allow transform from target · Issue #61027 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[ObjectMapper] Allow transform from target #61027
Open
@tems99

Description

@tems99

Description

Right now, the transform attribute only works from the source class. If you define a transform at the class level in the target class, it does not apply.

Use case:
Entities can be mapped to multiple DTO's.
Instead of the entity containing the mapping information, it would be ideal to have the DTO contain the mapping attribute.

Example

#[Map(source: BookingVoyage::class, transform: BookingVoyageApiTransformer::class)]
class BookingVoyageApi
{
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0