Skip to content

fix: 7787 - #7790

Open
KDederichs wants to merge 1 commit into
EasyCorp:4.xfrom
KDederichs:fix/7787
Open

fix: 7787#7790
KDederichs wants to merge 1 commit into
EasyCorp:4.xfrom
KDederichs:fix/7787

Conversation

@KDederichs

@KDederichs KDederichs commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

if enum class could not be resolved but it's already established that all choices are Enums, just grab the first one and get its class

Edit: targeting 4.x since it's a bugfix imo

Fixes #7787

@KDederichs
KDederichs force-pushed the fix/7787 branch 2 times, most recently from a4cff58 to d63cee6 Compare August 15, 2026 20:12
@KDederichs

Copy link
Copy Markdown
Contributor Author

Failing tests are related to the doctrine bridge being incompatible with the orm version.

Comment on lines +52 to +54
if (\count($choices) >= 1 && null === $enumTypeClass && $allChoicesAreEnums) {
$enumTypeClass = \get_class($choices[array_key_first($choices)]);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the relation should be resolved using resolveNestedAssociations so it can return the proper enum type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there ever a case where the enum type you map to it is different from the actual enum you have in there?
I can't think of any case where that would make sense and not lead to errors blowing up the entity cause the enum can not be parsed.

@KDederichs

Copy link
Copy Markdown
Contributor Author

Meh I just noticed setting the enum class actually breaks rendering of choice values when you explicitly map the names ['Foo' => Bar::Foo] I'll need to look at that eventually.

@KDederichs
KDederichs marked this pull request as draft August 21, 2026 08:31
… that all choices are Enums, just grab the first one and get its class

Fixes EasyCorp#7787
@KDederichs
KDederichs marked this pull request as ready for review August 22, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants