Open pkly opened 2 weeks ago
Hello,
How can we reproduce the bug with make:entity
command?
As I've pointed out above, you can trigger the crash by changing the return type of convertToPHPValue
to mixed
on the doctrine type class you're using while selecting the field.
For example, you could modify the built-in string column type for doctrine to return that from said method. A crash should occur then.
Hello,
I'm able to reliably crash the
make:entity
command on 1.61 because of the following line: https://github.com/symfony/maker-bundle/blob/ce60831a9d6c41c032117ddf59f303f56d004c87/src/Doctrine/DoctrineHelper.php#L291As this helper relies on the
convertToPHPValue
return type (very clever btw) it will crash if the return value is set tomixed
. This can be replicated with any custom doctrine type that is set in the application, with the following stack trace.It appears that the builder tries to make a field with type
mixed|null
or?mixed
butmixed
already implicitly includes null, which causes the error.After updating the return type for our custom type from
mixed
to a more sensiblestring|null
the error has stopped. Maybe in such a case a note should be printed to cli?