<p dir="auto">I read about Group Sequence Providers, which is pretty cool feature. I am wondering if it is possible to create group provider (instead doing this logic into forms)</p>
<p dir="auto">When I first had the need to use validation groups I accidentally stumbled across the GroupSequenceProvider until I found what I actually wanted to do.</p>
<p dir="auto">What I like about the GroupSequenceProvider is that you actually bind the validation logic to the entity configuration.</p>
<p dir="auto"><a href="http://symfony.com/doc/current/book/validation.html#group-sequence" rel="nofollow">http://symfony.com/doc/current/book/validation.html#group-sequence</a></p>
<p dir="auto">However with the validation groups it is not tied to the entity. I think a common use case is to validate based on the state of an entity. If you only validate your entities based on Forms you are unlikely to have any issues. However the entity validation logic is tied to the form configuration.</p>
<p dir="auto">I would suggest an Approach with an Interface lets call it <code class="notranslate">ValidationGroupsProdviderInterface</code> with a method <code class="notranslate">ValidationGroupsProdviderInterface::getValidationGroups()</code>. The Form component could rely on this as well, the logic of the groups is tied to the entity and the risk of missing proper validation is reduced.</p>
<p dir="auto">One concern which comes to my mind is the fact that the Validate method of the Validator accepts groups as parameters. And we also might travers through relations with the Valid() constraint. So the question would be when to use which groups.</p>
<p dir="auto">What do you think about this?</p>