I've an issue with validation groups.
When creating an user:
passwordcan't be blankpasswordlength should be between 4 and 16 characters
When editing an user:
passwordcan be blankpasswordshould be between 4 and 16 characters if it's filled
My user entity validation YAML, declaring the create group:
My\Entity\User:
properties:
username:
- NotBlank: ~
- Length: { min: 4, max: 12 }
email:
- Email: ~
- Length: { max: 255 }
plainPassword:
- NotBlank:
groups: [create]
- Length: { min: 4, max 16 }
As far as I know default is the group containing all validators to belonging to any group (that is all but NotBlank for password). Group create contains only the NotBlank rule for plainPassword. So:
- creating:
default+creategroups - editing:
defaultgroup
I'm passig array('validation_groups' => array('default', 'create')) when in my createAction controller action, and array('validation_groups' => array('default')) when editAction is invoked.
It doesn't work: when editing the password can be blank (correct) but if it's filled no errors occurs if - say - it's 3 characters long.
Isn't the default group supposed to be used as
Defaultwith capitalD?