Skip to content

Commit

Permalink
Fix ChoiceField when entity is enumType and no choices have been give…
Browse files Browse the repository at this point in the history
…n explicitly
  • Loading branch information
Uplink03 authored Oct 2, 2023
1 parent 6b1722a commit 7b1c924
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Field/Configurator/ChoiceConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7b1c924

Please sign in to comment.