From 7b1c924ed806cd9cfcdee9ff0c445d3effba5f54 Mon Sep 17 00:00:00 2001 From: Uplink03 <1977375+Uplink03@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:36:18 +0100 Subject: [PATCH] Fix ChoiceField when entity is enumType and no choices have been given explicitly --- src/Field/Configurator/ChoiceConfigurator.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Field/Configurator/ChoiceConfigurator.php b/src/Field/Configurator/ChoiceConfigurator.php index 8db5e14430..24847bbf54 100644 --- a/src/Field/Configurator/ChoiceConfigurator.php +++ b/src/Field/Configurator/ChoiceConfigurator.php @@ -52,7 +52,10 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c $enumTypeClass = $field->getDoctrineMetadata()->get('enumType'); if (0 === \count($choices) && null !== $enumTypeClass && enum_exists($enumTypeClass)) { $choices = $enumTypeClass::cases(); - } elseif ($allChoicesAreEnums) { + $allChoicesAreEnums = true; + } + + if ($allChoicesAreEnums) { $processedEnumChoices = []; foreach ($choices as $choice) { if ($choice instanceof \BackedEnum) {