You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: true in the column metadata definition.
Q
A
BC Break
no
Version
2.19.7
Summary
For example, we have the following entity:
class User
{
// ...
#[ORM\Column(type: Types::STRING, length: 64)]
private ?string$name;
// ...
}
Schema validation tool should report, that mapping is invalid due to property is type string|null, but metadata mapping expecting string due to nullable named property of ORM\Column is false by default. The error should gone when manually will be specified nullable: true of ORM\Column.
Current behavior
There are no errors for provided example class, but should be.
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 run orm:validate-schema.
Expected behavior
The command should report mapping error:
Mapping
-------
[FAIL] The entity-class App\Entity\User mapping is invalid:
* The field 'App\Entity\User#name' has the property type 'string|null' that differs from the metadata field type 'string' returned by the 'string' DBAL type.
The text was updated successfully, but these errors were encountered:
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: true
in 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 expectingstring
due tonullable
named property ofORM\Column
isfalse
by default. The error should gone when manually will be specifiednullable: true
ofORM\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:
The text was updated successfully, but these errors were encountered: