mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 06:16:05 +03:00
Oops, added missing parseValue for EnumType
This commit is contained in:
parent
83e33659cb
commit
c312f73df3
@ -53,12 +53,30 @@ class EnumType extends Type implements InputType, OutputType
|
||||
return $this->_values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return null
|
||||
*/
|
||||
public function serialize($value)
|
||||
{
|
||||
$enumValue = $this->_getValueLookup()->offsetGet($value);
|
||||
return $enumValue ? $enumValue->name : null;
|
||||
$lookup = $this->_getValueLookup();
|
||||
return isset($lookup[$value]) ? $lookup[$value]->name : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return null
|
||||
*/
|
||||
public function parseValue($value)
|
||||
{
|
||||
$lookup = $this->_getNameLookup();
|
||||
return isset($lookup[$value]) ? $lookup[$value]->value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return null
|
||||
*/
|
||||
public function parseLiteral($value)
|
||||
{
|
||||
if ($value instanceof EnumValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user