我有一个新的Symfony 7应用程序,它支持用户帐户。其基本设置非常简单:
symfony new mimesia --version="7.1.*" --webapp
php bin/console make:user
应用程序必须与现有数据库进行对话,该数据库与Symfony使用的方案基本兼容。但是,现有数据的已验证列被调用
verified
而不是
is_verified
,而且可以
NULL
.
解决这种差异应该很容易,所以我只是扩展了中的条令注释
Entity/User
就像这样:
#[ORM\Column(name: 'verified', type: 'boolean', nullable: true)]
private bool $isVerified = false;
当我尝试运行应用程序时,它会遇到服务器错误:
无法将null分配给属性
App\Entity\User::$isVerified
bool类型
这对我来说毫无意义,因为
nullable
flag应该处理好这个问题。这是库中的错误,还是我遗漏了什么?不管怎样,我们该怎么解决?