FOS 用户创建时列 'salt' 不能为空
Column 'salt' cannot be null at FOS user create
它在前一段时间工作,但现在由于某种原因它产生了异常。我有自定义用户实体,它扩展了 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
{
...
}
我的自定义 class 中没有 setSalt()。正如我在转储 SQL 查询中看到的那样,其他非自定义字段(email_canonical、已启用、密码等)设置正确。我还能检查什么?
更新
我做了作曲家更新。这是我的 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 列应该允许为空,因为在使用 bcryp
算法时它确实为空,如 the salt is directly included in the password (hash)。此外,这里是映射声明:
<field name="salt" column="salt" type="string" nullable="true" />
PS: 和其他建议,更新所有包,清除缓存,数据库及其数据...
更新:
根据 dMedia,他们在最近的更新(2016 年 11 月)中更改了学说映射
它在前一段时间工作,但现在由于某种原因它产生了异常。我有自定义用户实体,它扩展了 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
{
...
}
我的自定义 class 中没有 setSalt()。正如我在转储 SQL 查询中看到的那样,其他非自定义字段(email_canonical、已启用、密码等)设置正确。我还能检查什么?
更新
我做了作曲家更新。这是我的 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 列应该允许为空,因为在使用 bcryp
算法时它确实为空,如 the salt is directly included in the password (hash)。此外,这里是映射声明:
<field name="salt" column="salt" type="string" nullable="true" />
PS: 和其他建议,更新所有包,清除缓存,数据库及其数据...
更新:
根据 dMedia,他们在最近的更新(2016 年 11 月)中更改了学说映射