diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php index fbaf33bd01d..d5ad91a1770 100644 --- a/lib/Doctrine/ORM/Tools/SchemaValidator.php +++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php @@ -406,6 +406,25 @@ function (array $fieldMapping) use ($class): ?string { ); } + if ( + isset($fieldMapping['enumType']) + && $propertyType !== $fieldMapping['enumType'] + && interface_exists($propertyType) + && is_a($fieldMapping['enumType'], $propertyType, true) + ) { + if ($metadataFieldType === (string) (new ReflectionEnum($fieldMapping['enumType']))->getBackingType()) { + return null; + } + + return sprintf( + "The field '%s#%s' has the metadata enumType '%s' that differs from the metadata field type '%s'.", + $class->name, + $fieldName, + $fieldMapping['enumType'], + $metadataFieldType + ); + } + if ( $fieldMapping['type'] === 'json' && in_array($propertyType, ['string', 'int', 'float', 'bool', 'true', 'false', 'null'], true) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH11037/EntityStatus.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH11037/EntityStatus.php new file mode 100644 index 00000000000..f94c44affe0 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH11037/EntityStatus.php @@ -0,0 +1,9 @@ +