Can't override validation in SF4
sbruev opened this issue · comments
So, I'm trying to make a custom validation group. I've decided to test it with simple alteration to the registration validation rule, by increasing the min length to 6 characters. Right now my configuration is following:
# config/packages/fos_user.yaml
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: App\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
registration:
form:
type: FOS\UserBundle\Form\Type\RegistrationFormType
validation_groups: [CustomValidation]
# config/packages/validator/validation.yaml
FOS\UserBundle\Model\User:
properties:
username:
- NotBlank:
groups: [CustomValidation]
- Length:
min: 6
minMessage: fos_user.password.short
groups: [CustomValidation]
I've checked that the FOSUser config has updated with dump:config
. I've run cache:clear
. Yet the FOSUser ignores my config and continue to use the standard validation rules for registration (i.e. 2 chars min).
What am I missing here?