Skip to content

Commit e41ffb7

Browse files
authored
Merge pull request #4 from korobkovandrey/fix/field-resolve-error
fix/field-resolve-error: fix error exception for non BackedEnum when n…
2 parents f29b973 + 462ab34 commit e41ffb7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Enum.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ public function __construct($name, $attribute = null, callable $resolveCallback
1919
parent::__construct($name, $attribute, $resolveCallback);
2020
$this->resolveUsing(
2121
function ($value) {
22-
return $value instanceof UnitEnum ? $value->value : $value;
22+
if($value instanceof BackedEnum){
23+
return $value->value;
24+
}
25+
return $value instanceof UnitEnum ? $value->name : $value;
2326
}
2427
);
2528

0 commit comments

Comments
 (0)