w3r-one / json-schema-bundle

serialize Symfony Forms into JSON schema
MIT License
2 stars 0 forks source link

Add a compiler pass to register transformers in the container #11

Closed laurent-bientz closed 7 months ago

laurent-bientz commented 8 months ago

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.

laurent-bientz commented 7 months ago

fixed in 1.1.0