Skip to content
Advertisement

Using validation groups on EasyAdmin 3.x

I want to use validation groups with EasyAdmin 3.x when creating a new User to validate every field.

I have a User entity with name, phone, and email fields and use @UniqueEntity in a “creation” group, so I can update the User in a form I created outside from EasyAdmin. That works just fine, but I can’t manage to find how to tell EasyAdmin to use the Default group and my creation group when I am using the new action.

Here is the simplified User entity with the constraints I have

JavaScript

And the full LeadCrudController used with EasyAdmin

JavaScript

Advertisement

Answer

I found the solution in the EasyAdmin git issues: [EA3] add validation groups #3690

I had to add the setFormOptions method to the crud configuration

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement