mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Metadata field type validation against Entity property type does not detect nullability #7422
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AlexMinaev19 on GitHub (Oct 2, 2024).
Bug Report
In feature request there was added an ability to validate field type against Entity property type.
Schema validation tool does not detect mapping problems when a typed property of the entity defined as nullable, but there is no
nullable: truein the column metadata definition.Summary
For example, we have the following entity:
Schema validation tool should report, that mapping is invalid due to property is type
string|null, but metadata mapping expectingstringdue tonullablenamed property ofORM\Columnisfalseby default. The error should gone when manually will be specifiednullable: trueofORM\Column.Current behavior
There are no errors for provided example class, but should be.
How to reproduce
Create entity:
Create migration based on this entity. The table definition in migration will have a non-nullable column
name. After that, please go ahead and execute this migration. And then runorm:validate-schema.Expected behavior
The command should report mapping error: