I am new with Symfony2 and so I am with FOSUserbundle, the registration form I wrote got different fields mandatory based on if it is a company or private person, I set it up etc and if I hardcode the valdiation group in the fos config it will work, but what I need is to set it up dynamic based on the form submit data, I tried to follow: http://symfony.com/doc/current/book/forms.html#book-forms-validation-groups
Seeing that FOSUserbundle use the deprecated OptionsResolverInterface , I even tried it with that one, but whatever I do it is never called.
So my question is kinda, what is the right approach with that bundle to change the valdiation group on the fly based on the submitted data?
Figured it out myself how to do and because I could nowhere on the internet find the solution, answering here my own question for the case someone else need that too:
in the config.yml i set the validationgroup like this
and inside that class then:
And that one returns an array with the validations groups, just dont forget to include for registration for example Registration or it wont validate if the user already exists etc