Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.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
Symfony 使用FOSUserBundle创建新用户失败_Symfony_Fosuserbundle - Fatal编程技术网

Symfony 使用FOSUserBundle创建新用户失败

Symfony 使用FOSUserBundle创建新用户失败,symfony,fosuserbundle,Symfony,Fosuserbundle,我正在尝试从命令行创建新用户,并出现以下错误: Warning: array_search() expects parameter 2 to be array, null given in /vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Model/User.php line 368 当尝试通过webinterface注册创建用户时,我得到以下信息: SQLSTATE[23000]: Integrity constraint viol

我正在尝试从命令行创建新用户,并出现以下错误:

Warning: array_search() expects parameter 2 to be array, null given
in /vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Model/User.php line 368  
当尝试通过webinterface注册创建用户时,我得到以下信息:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
使用现有用户登录可以正常工作。同时更新配置文件和更改密码。仅仅创建新用户是行不通的

我在一个非常简单的设置中使用v1.3.1,还没有找到任何解决方案

有什么想法吗?

修正了


我的用户实体中有一个自定义构造函数方法。在那里,我忘了用
parent::u construct()调用父构造函数

也许它能帮助别人。使用bcrypt编码器时可以看到此错误

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
要解决此问题,只需在用户类中为salt属性添加映射覆盖(使其可为null)

或:不要忘记更新您的模式。如果在编写器更新后发生错误

bin/console doctrine:schema:update --force
bin/console doctrine:schema:update --force