Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #566 +/- ##
=========================================
Coverage 91.59% 91.60%
- Complexity 2013 2015 +2
=========================================
Files 131 131
Lines 5223 5229 +6
=========================================
+ Hits 4784 4790 +6
Misses 439 439 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds BackedEnum support for Single Table Inheritance discriminator values, allowing enum cases to be used when resolving child classes and scalar-backed values to be persisted through typecasting.
Changes:
- Normalizes BackedEnum discriminator values in STI class resolution.
- Adds BackedEnum uncasting in
Typecastso enum cases persist as scalar backing values. - Adds cross-driver functional coverage for string-backed, int-backed, and entity-property discriminator scenarios.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Mapper/Traits/SingleTableTrait.php |
Resolves STI child classes using enum backing values. |
src/Parser/Typecast.php |
Adds enum case to scalar conversion during uncast. |
tests/ORM/Functional/Driver/Common/Inheritance/STI/EnumDiscriminatorTest.php |
Adds string-backed enum discriminator tests. |
tests/ORM/Functional/Driver/Common/Inheritance/STI/IntEnumDiscriminatorTest.php |
Adds int-backed enum discriminator tests. |
tests/ORM/Functional/Driver/Common/Inheritance/STI/EnumPropertyDiscriminatorTest.php |
Adds tests for enum discriminator exposed as entity property. |
tests/ORM/Functional/Driver/Common/Inheritance/Fixture/EmployeeType.php |
Adds string-backed enum fixture. |
tests/ORM/Functional/Driver/Common/Inheritance/Fixture/EmployeeKind.php |
Adds int-backed enum fixture. |
tests/ORM/Functional/Driver/Common/Inheritance/Fixture/WorkerWithKind.php |
Adds base fixture with enum discriminator property. |
tests/ORM/Functional/Driver/Common/Inheritance/Fixture/BossWithKind.php |
Adds child fixture for enum-property STI tests. |
tests/ORM/Functional/Driver/MySQL/Inheritance/STI/*Enum*Test.php |
Wires common enum STI tests for MySQL. |
tests/ORM/Functional/Driver/Postgres/Inheritance/STI/*Enum*Test.php |
Wires common enum STI tests for Postgres. |
tests/ORM/Functional/Driver/SQLite/Inheritance/STI/*Enum*Test.php |
Wires common enum STI tests for SQLite. |
tests/ORM/Functional/Driver/SQLServer/Inheritance/STI/*Enum*Test.php |
Wires common enum STI tests for SQL Server. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 What was changed
Added an ability to use BackedEnum as an STI discriminator.
📝 Checklist
📃 Documentation