Unfortunately with this approach, it is impossible to use dependency injection at the level of the custom transformer to use other services that the ones provided in AbstractTransformer.
We need to tag all transformers in services.xml, add a compiler pass in the bundle to register them in the container and call a setter to map the correct formtype/transformer association on the Resolver.
The resolver will have the tagged service from the container definition, we'll not need anymore to instantiate dynamically the transformer and we will be able to inject other services in the custom transformer.
Actually we dynamically instantiate the right transformer based on the current formtype.
Unfortunately with this approach, it is impossible to use dependency injection at the level of the custom transformer to use other services that the ones provided in AbstractTransformer.
We need to tag all transformers in services.xml, add a compiler pass in the bundle to register them in the container and call a setter to map the correct formtype/transformer association on the Resolver.
The resolver will have the tagged service from the container definition, we'll not need anymore to instantiate dynamically the transformer and we will be able to inject other services in the custom transformer.