Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't override validation in SF4 #2886

Open
sbruev opened this issue Dec 18, 2018 · 1 comment
Open

Can't override validation in SF4 #2886

sbruev opened this issue Dec 18, 2018 · 1 comment

Comments

@sbruev
Copy link

sbruev commented Dec 18, 2018

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?

@gustawdaniel
Copy link

I have similar problem but with 8 chars as min length of password because of update

commit:

4281aa6

merge:

#2839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants