Skip to content

feat(transformer): allow to pass invokable object in transformer#316

Merged
joelwurtz merged 1 commit into
mainfrom
feat/invokable-transformer
Jan 26, 2026
Merged

feat(transformer): allow to pass invokable object in transformer#316
joelwurtz merged 1 commit into
mainfrom
feat/invokable-transformer

Conversation

@joelwurtz

@joelwurtz joelwurtz commented Jan 22, 2026

Copy link
Copy Markdown
Member

It allow having :

class Foo
{
    #[MapTo(transformer: new CustomTransformer())]
    public string $foo;
}

class CustomTransformer
{
    public function __invoke($value, $source, $context)
    {
       // ...
       return $transformedValue;
    }
}

@joelwurtz

Copy link
Copy Markdown
Member Author

I'm not sure how we should handle this with the already existing PropertyTransformerInterface which is done when we want to pass a service (with other dependencies).

Should we merge both cases into a single interface ?

@joelwurtz joelwurtz force-pushed the feat/invokable-transformer branch from 9afe43a to 1a5ea0e Compare January 26, 2026 13:36

@Korbeil Korbeil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need to merge the interface with it now

@joelwurtz joelwurtz merged commit f1f7ef0 into main Jan 26, 2026
5 checks passed
@joelwurtz joelwurtz deleted the feat/invokable-transformer branch January 26, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants