FriendsOfSymfony/FOSUserBundle — Issue #480: Build my own registration form with unique username
Author: stoefln
Created: 2012-01-10 10:14:40+00:00
State: open

Hi 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 documentation[1], but without any effect.

Further I tried to make use of the "Registration" validation group, as proposed on stackoverflow[2], unfortunately without any effect.

Can you help me?
[1] http://symfony.com/doc/current/reference/constraints/UniqueEntity.html
[2] http://stackoverflow.com/a/8746351/457059