I have a new Symfony 7 application, that supports user accounts. The basic setup for this is very straightforward:
symfony new mimesia --version="7.1.*" --webapp
php bin/console make:user
The application has to talk to an existing database, which is mostly compatible with the scheme Symfony uses. However, the verified column of the existing data is called verified
, rather than is_verified
, and it can be NULL
.
Solving this discrepancy should be easy enough, so I just extended the Doctrine annotations in Entity/User
like so:
#[ORMColumn(name: 'verified', type: 'boolean', nullable: true)]
private bool $isVerified = false;
When I try to run the application, it runs into a server error:
Cannot assign null to property
AppEntityUser::$isVerified
of type bool
This makes no sense to me, because the nullable
flag should have taken care of that. Is this a bug in the libraries, or am I missing something? Either way, how can we fix this?