Limenius / LiformBundle

Symfony Bundle to render Symfony Forms to JSON Schema
MIT License
138 stars 44 forks source link

Added tags to add transformers and extensions, added parameters for service classes #6

Closed sjopet closed 7 years ago

sjopet commented 7 years ago

forgot to update the readme will update asap

nacmartin commented 7 years ago

Thanks @sjopet. The update in the README would be great indeed :)

nacmartin commented 6 years ago

Hi. Related to this PR. I am having problems with parameters for service classes. This is also discouraged and was removed from the Symfony code itself https://github.com/symfony/symfony/issues/11881

Basically the problem that I am facing is that in Sf3.3/3.4/4 you are supposed to use the class as id of the service. ( https://symfony.com/doc/current/service_container/3.3-di-changes.html#step-2-using-class-service-id-s ), and it won't work if the class itself is a parameter.

I am going to set the id to the class in the id at least for the liform service, that is the one I need to have access to at least to upgrade the sandbox to Sf4, but I am inclined to remove the definition of parameters for classes in the other cases as well.

sjopet commented 6 years ago

Hi, Your right the parameterized classes need to be reverted. The last change you made to the 'liform' service definition (removing the class) breaks compatability with symfony 2.8 though and results in the following error:

The definition for "limenius\liform\liform" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.

I noticed there is no Symfony version or even the dependency declaration itself in the composer.json file. I guess this would be a good time to add it and branch your bundle to accomodate for different symfony versions so we can adjust the dependency injection config accordingly.

I'll add a pr to fix the class parameters I think that should still work with sf3 and 4 for now.

nacmartin commented 6 years ago

Ok, thanks for the report and the future PR :). I think that it should be possible to keep compatibility with 2.8, just by adding a redundant class="Limenius\Liform\Liform". Will try later, hopefully today.