I have my own User
Class, which inherits FOS\UserBundle\Entity\User
. Additionally I wrote my own registration routine. Now I have the problem that the form does not make sure that the username is unique. I always get:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'myusername' for key 'UNIQ_2DA1797792FC23A8'
I tried adding the @UniqueEntity("email")
annotation as stated in the documentation1, but without any effect.
Someone knows what might be wrong?
The constraint exists in the FOS bundle already. You probably need to set the validation_groups
option on your form to array('Registration')
.