嗨,我有我自己的User
类,它继承FOS\UserBundle\Entity\User
。另外我写了我自己的注册程序。现在我遇到了表单不能确保用户名是唯一的问题。我总是得到SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'myusername' for key 'UNIQ_2DA1797792FC23A8'
Symfony2:如何使FOSUserBundle用户的用户名唯一
我试着在文档[1]中添加@UniqueEntity("email")
注释,但没有任何效果。
有人知道什么可能是错的?
[1] http://symfony.com/doc/current/reference/constraints/UniqueEntity.html
这不会有任何影响:/还有什么想法? – stoefln 2012-01-09 13:42:51
但是,这里是链接到文档:http://symfony.com/doc/2.0/book/forms.html#book-forms-validation-groups – stoefln 2012-01-11 11:48:44
在github上发布了一个问题。那里有很棒的支持团队非常感谢@stof指出我没有实际验证用户对象,而只是表单数据。更多信息:https://github.com/FriendsOfSymfony/FOSUserBundle/issues/480 – stoefln 2012-01-12 11:12:58