| @@ 338-345 (lines=8) @@ | ||
| 335 |     { | |
| 336 | $currentType = $queryType->getNullableType(); | |
| 337 | ||
| 338 |         if ($currentType->getKind() == TypeMap::KIND_SCALAR) { | |
| 339 |             if (!$query->hasFields()) { | |
| 340 | return $this->getOutputValue($currentType, $resolvedValue); | |
| 341 |             } else { | |
| 342 |                 $this->executionContext->addError(new ResolveException(sprintf('Fields are not found in query "%s"', $query->getName()))); | |
| 343 | ||
| 344 | return null; | |
| 345 | } | |
| 346 | } | |
| 347 | ||
| 348 |         foreach ($query->getFields() as $fieldAst) { | |
| @@ 194-200 (lines=7) @@ | ||
| 191 | public function isValidValueForField(AbstractField $field, $value) | |
| 192 |     { | |
| 193 | $fieldType = $field->getType(); | |
| 194 |         if ($fieldType->getKind() == TypeMap::KIND_NON_NULL && is_null($value)) { | |
| 195 |             $this->executionContext->addError(new ResolveException(sprintf('Cannot return null for non-nullable field %s', $field->getName()))); | |
| 196 | ||
| 197 | return null; | |
| 198 |         } else { | |
| 199 | $fieldType = $this->resolveTypeIfAbstract($fieldType->getNullableType(), $value); | |
| 200 | } | |
| 201 | ||
| 202 |         if (!is_null($value) && !$fieldType->isValidValue($value)) { | |
| 203 |             $this->executionContext->addError(new ResolveException(sprintf('Not valid value for %s field %s', $fieldType->getNullableType()->getKind(), $field->getName()))); | |