I am using FOSUserBundle. In my project, I created my own UserBundle and overrode the controller, the forms and the handlers. Now when a user tries to register with an exist
validation.yml
should be in your user bundle.
/app/config/config.yml
should be updated as follow:
validation: { enabled: true, enable_annotations: false }
Solved the issue by:
validation.yml:
YOP\YourOwnPoetBundle\Entity\User:
constraints:
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: email
properties:
email:
- Email: { groups: [Registration] }
plainPassword:
- MinLength: { limit: 5, message: "Your password must have at least {{ limit }} characters" }
name:
- NotBlank: { groups: [Registration] }
familyName:
- NotBlank: { groups: [Registration] }
sex:
- Choice: { choices: [1, 2], groups: [Registration] }
birthdate:
- NotNull: { groups: [Registration] }
city:
- NotBlank: { groups: [Registration] }
howDidYouHear:
- Choice: { choices: [1, 2, 3, 4, 5, 6, 7, 8], groups: [Registration] }