| @@ 243-249 (lines=7) @@ | ||
| 240 | public function isValidValueForField(FieldInterface $field, $value) |
|
| 241 | { |
|
| 242 | $fieldType = $field->getType(); |
|
| 243 | if ($fieldType->getKind() == TypeMap::KIND_NON_NULL && is_null($value)) { |
|
| 244 | $this->executionContext->addError(new ResolveException(sprintf('Cannot return null for non-nullable field %s', $field->getName()))); |
|
| 245 | ||
| 246 | return null; |
|
| 247 | } else { |
|
| 248 | $fieldType = $this->resolveTypeIfAbstract($fieldType->getNullableType(), $value); |
|
| 249 | } |
|
| 250 | ||
| 251 | if (!is_null($value) && !$fieldType->isValidValue($value)) { |
|
| 252 | $this->executionContext->addError(new ResolveException(sprintf('Not valid value for %s field %s', $fieldType->getNullableType()->getKind(), $field->getName()))); |
|
| @@ 320-327 (lines=8) @@ | ||
| 317 | $innerOriginalType = $innerOriginalType->getTypeOf(); |
|
| 318 | } |
|
| 319 | ||
| 320 | if ($currentType->getKind() == TypeMap::KIND_SCALAR) { |
|
| 321 | if (!$query->hasFields()) { |
|
| 322 | return $this->getOutputValue($currentType, $resolvedValue); |
|
| 323 | } else { |
|
| 324 | $this->executionContext->addError(new ResolveException(sprintf('Fields are not found in query "%s"', $query->getName()))); |
|
| 325 | ||
| 326 | return null; |
|
| 327 | } |
|
| 328 | } |
|
| 329 | ||
| 330 | foreach ($query->getFields() as $fieldAst) { |
|