Skip to content

Commit bd40751

Browse files
committed
fix(doctrine): fixed backed enum fiter to always use case name as filter value
1 parent 535bbf5 commit bd40751

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Doctrine/Common/Filter/BackedEnumFilterTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getDescription(string $resourceClass): array
5959
'required' => false,
6060
'schema' => [
6161
'type' => 'string',
62-
'enum' => array_map(fn (\BackedEnum $case) => $case->value, $this->enumTypes[$property]::cases()),
62+
'enum' => array_map(fn (\BackedEnum $case) => $case->name, $this->enumTypes[$property]::cases()),
6363
],
6464
];
6565
}
@@ -80,7 +80,7 @@ abstract protected function isBackedEnumField(string $property, string $resource
8080

8181
private function normalizeValue($value, string $property): mixed
8282
{
83-
$values = array_map(fn (\BackedEnum $case) => $case->value, $this->enumTypes[$property]::cases());
83+
$values = array_map(fn (\BackedEnum $case) => $case->name, $this->enumTypes[$property]::cases());
8484

8585
if (\in_array($value, $values, true)) {
8686
return $value;

0 commit comments

Comments
 (0)