Fixed unserializing enum values

This commit is contained in:
Marcin Kurczewski 2014-09-17 11:24:54 +02:00
parent 815a37cf9a
commit 932407a571

View file

@ -82,9 +82,10 @@ class EnumHelper
private static function stringToEnum($enumMap, $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);
return $enumMap[$key];
return $lowerEnumMap[$key];
}
}