mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 12:56: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;
|
return $this->_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $value
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
public function serialize($value)
|
public function serialize($value)
|
||||||
{
|
{
|
||||||
$enumValue = $this->_getValueLookup()->offsetGet($value);
|
$lookup = $this->_getValueLookup();
|
||||||
return $enumValue ? $enumValue->name : null;
|
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)
|
public function parseLiteral($value)
|
||||||
{
|
{
|
||||||
if ($value instanceof EnumValue) {
|
if ($value instanceof EnumValue) {
|
||||||
|
Loading…
Reference in New Issue
Block a user