Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix enum mapping validation #11122

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Conversation

yceruto
Copy link
Contributor

@yceruto yceruto commented Dec 14, 2023

Closes #11119

@yceruto yceruto force-pushed the enum_with_interface branch 3 times, most recently from f5bd990 to 75485d0 Compare December 14, 2023 20:31
greg0ire
greg0ire previously approved these changes Dec 14, 2023
Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After re-reading the first case, my brain hurts but I think it's indeed really different. I think you actually went with the right way, combining the conditions is probably going to produce something very hard to understand.

@yceruto
Copy link
Contributor Author

yceruto commented Dec 14, 2023

Still, I improved the first error message to include the backing type information.

@@ -40,8 +40,9 @@ public function testMetadataFieldTypeNotCoherentWithEntityPropertyType(): void

self::assertEquals(
[
"The field 'Doctrine\Tests\ORM\Functional\Ticket\GH11037\InvalidEntityWithTypedEnum#status1' has the property type 'Doctrine\Tests\ORM\Functional\Ticket\GH11037\StringEntityStatus' that differs from the metadata field type 'int' returned by the 'integer' DBAL type.",
"The field 'Doctrine\Tests\ORM\Functional\Ticket\GH11037\InvalidEntityWithTypedEnum#status1' has the property type 'Doctrine\Tests\ORM\Functional\Ticket\GH11037\StringEntityStatus' with a backing type of 'string' that differs from the metadata field type 'int'.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, that's way better 👍

@greg0ire greg0ire added the Bug label Dec 14, 2023
@greg0ire greg0ire added this to the 2.17.2 milestone Dec 15, 2023
@greg0ire greg0ire merged commit e50ae06 into doctrine:2.17.x Dec 15, 2023
58 checks passed
@greg0ire
Copy link
Member

Thanks @yceruto !

@yceruto yceruto deleted the enum_with_interface branch December 15, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BackedEnum type with interface validation mismatch
3 participants