Fixed unserializing enum values
This commit is contained in:
parent
815a37cf9a
commit
932407a571
1 changed files with 3 additions and 2 deletions
|
@ -82,9 +82,10 @@ class EnumHelper
|
||||||
private static function stringToEnum($enumMap, $enumString)
|
private static function stringToEnum($enumMap, $enumString)
|
||||||
{
|
{
|
||||||
$key = trim(strtolower($enumString));
|
$key = trim(strtolower($enumString));
|
||||||
if (!isset($enumMap[$key]))
|
$lowerEnumMap = array_change_key_case($enumMap, \CASE_LOWER);
|
||||||
|
if (!isset($lowerEnumMap[$key]))
|
||||||
throw new \DomainException('Unrecognized value: ' . $enumString);
|
throw new \DomainException('Unrecognized value: ' . $enumString);
|
||||||
|
|
||||||
return $enumMap[$key];
|
return $lowerEnumMap[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue