Use name as value for Enums if value wasn't set in definition

This commit is contained in:
vladar 2015-08-30 13:47:09 +06:00
parent 9ccfb93ef2
commit 74b922ce68

View File

@ -40,7 +40,7 @@ class EnumType extends Type implements InputType, OutputType
if (!empty($config['values'])) { if (!empty($config['values'])) {
foreach ($config['values'] as $name => $value) { foreach ($config['values'] as $name => $value) {
$this->_values[] = Utils::assign(new EnumValueDefinition(), $value + ['name' => $name]); $this->_values[] = Utils::assign(new EnumValueDefinition(), $value + ['name' => $name, 'value' => $name]); // value will be equal to name only if 'value' is not set in definition
} }
} }
} }