Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Fosuserbundle寄存器验证不起作用_Php_Symfony_Doctrine_Fosuserbundle - Fatal编程技术网

Php Fosuserbundle寄存器验证不起作用

Php Fosuserbundle寄存器验证不起作用,php,symfony,doctrine,fosuserbundle,Php,Symfony,Doctrine,Fosuserbundle,当我向现有电子邮件注册时,在registerAction中,RegisterController$form->isValid()返回true,尽管Fosuserbundle中存在约束,但我收到了DBALException(执行“插入到…”时发生异常) 我创建了一个继承FOSUserBundle的捆绑包,MyUser实体继承BaseUser,我验证了RegistrationFormType。您应该使用验证在电子邮件字段上添加Uniquentity约束,您可以直接将其添加到实体文件(或使用yml文件

当我向现有电子邮件注册时,在registerAction中,RegisterController
$form->isValid()
返回true,尽管Fosuserbundle中存在约束,但我收到了DBALException(执行“插入到…”时发生异常)


我创建了一个继承FOSUserBundle的捆绑包,MyUser实体继承BaseUser,我验证了RegistrationFormType。

您应该使用验证在电子邮件字段上添加Uniquentity约束,您可以直接将其添加到实体文件(或使用yml文件,如您所愿):


通过验证,在调用
$form->isValid()
时将检查该字段,如果数据库中已经存在该电子邮件,则会返回错误。

这是有效的,我以为fosuserbundle中已经描述了它。非常感谢。