Skip to content

Fix filter to use translated labels for enums implementing TranslatableInterface#7576

Merged
javiereguiluz merged 1 commit into
EasyCorp:4.xfrom
lacatoire:fix/filter-translatable-backed-enum
May 1, 2026
Merged

Fix filter to use translated labels for enums implementing TranslatableInterface#7576
javiereguiluz merged 1 commit into
EasyCorp:4.xfrom
lacatoire:fix/filter-translatable-backed-enum

Conversation

@lacatoire
Copy link
Copy Markdown
Contributor

When a backed enum implements TranslatableInterface and is passed to ChoiceFilter::setTranslatableChoices(MyEnum::cases()), the filter submitted the list indices (0, 1, 2, ...) instead of the enum values, so no row ever matched.

The fix detects a list of UnitEnum / BackedEnum cases and uses their backing values (or names) as submitted values, keeping the enum instances as labels so TranslatableInterface keeps working.

Fixes #7571

@Seb33300
Copy link
Copy Markdown
Contributor

Maybe related to #7243

@javiereguiluz javiereguiluz added this to the 4.x milestone May 1, 2026
@javiereguiluz javiereguiluz changed the base branch from 5.x to 4.x May 1, 2026 18:09
@javiereguiluz javiereguiluz force-pushed the fix/filter-translatable-backed-enum branch from 72c05ad to e4890bb Compare May 1, 2026 18:09
@javiereguiluz javiereguiluz merged commit f71eee4 into EasyCorp:4.x May 1, 2026
17 checks passed
@javiereguiluz
Copy link
Copy Markdown
Collaborator

Thank you Louis-Arnaud! Merged in 4.x and 5.x.

@lacatoire lacatoire deleted the fix/filter-translatable-backed-enum branch May 2, 2026 12:04
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.

[Filter] Filtering translatable backed enums is broken

3 participants