Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.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
Doctrine orm 列';盐';FOS用户创建时不能为空_Doctrine Orm_Symfony_Fosuserbundle - Fatal编程技术网

Doctrine orm 列';盐';FOS用户创建时不能为空

Doctrine orm 列';盐';FOS用户创建时不能为空,doctrine-orm,symfony,fosuserbundle,Doctrine Orm,Symfony,Fosuserbundle,它在一段时间前工作过,但现在由于某种原因它产生了异常。我有自定义用户实体,它扩展了FOS用户: namespace AppBundle\Entity; use FOS\UserBundle\Model\User as BaseUser; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository") * @ORM\Table(name="fos_

它在一段时间前工作过,但现在由于某种原因它产生了异常。我有自定义用户实体,它扩展了FOS用户:

namespace AppBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
...
}
我的自定义类中没有setAlt()。正如我在转储SQL查询中看到的,其他非自定义字段(email_canonical、enabled、password等)设置正确。我还能查什么

更新

我做了作曲家的更新。这是我的composer.json

"require": {
    "php": ">=5.5.9",
    "symfony/symfony": "3.2.*",
    "doctrine/orm": "^2.5",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/doctrine-cache-bundle": "^1.2",
    "symfony/swiftmailer-bundle": "^2.3",
    "symfony/monolog-bundle": "^2.8",
    "symfony/polyfill-apcu": "^1.0",
    "sensio/distribution-bundle": "^5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "^2.0",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "hwi/oauth-bundle": "^0.5.1",
    "twig/extensions": "^1.4"
},

必须删除架构并重新创建它。您的salt列应该允许为null,因为当使用
bcryp
算法时,它实际上是null。此外,以下是映射声明:

<field name="salt" column="salt" type="string" nullable="true" /> 

PS:还有其他建议,更新所有包,清除缓存,数据库及其数据


更新:

根据dMedia,他们在最近的更新(2016年11月)中更改了条令映射


您是否更新了FOSUserBundle?在最新版本中有BC。这可能是原因。我更新了问题。我的用户包版本是否与Symfony版本不兼容?能否向我们展示您的用户构造函数?我的用户类中没有_construct()方法。确实如此。他们改变了原则<代码>php bin/控制台原则:schema:update--force完成了任务。