Symfony 2.8/3.0 upgrade: how to deal with form types with variable parameters? Symfony 2.8/3.0 upgrade: how to deal with form types with variable parameters? symfony symfony

Symfony 2.8/3.0 upgrade: how to deal with form types with variable parameters?


Well, after digging this topic a bit more, someone already asked the question directly in the PR concerning this change in Symfony 2.8.

And the answer is that the pattern I was doing is not possible anymore, so I see 2 solutions to my problem:

  • Create as many classes as I had services for my custom types instead of using all the time the same class, and make these classes extend an abstract one (in my example: create Gender1Type and Gender2Type classes that extend a AbstractGenderType abstract class)
  • Keep only one class, but add options to it to pass my specific parameters.