|
5 | 5 | namespace Overblog\GraphQLBundle\Config\Parser\MetadataParser;
|
6 | 6 |
|
7 | 7 | use Doctrine\Common\Annotations\AnnotationException;
|
| 8 | +use GraphQL\Type\Definition\ResolveInfo; |
8 | 9 | use Overblog\GraphQLBundle\Annotation\Annotation as Meta;
|
9 | 10 | use Overblog\GraphQLBundle\Annotation as Metadata;
|
10 | 11 | use Overblog\GraphQLBundle\Annotation\InputField;
|
|
15 | 16 | use Overblog\GraphQLBundle\Config\Parser\PreParserInterface;
|
16 | 17 | use Overblog\GraphQLBundle\Relay\Connection\ConnectionInterface;
|
17 | 18 | use Overblog\GraphQLBundle\Relay\Connection\EdgeInterface;
|
| 19 | +use Overblog\GraphQLBundle\Transformer\ArgumentsTransformer; |
18 | 20 | use ReflectionClass;
|
19 | 21 | use ReflectionClassConstant;
|
20 | 22 | use ReflectionException;
|
21 | 23 | use ReflectionMethod;
|
| 24 | +use ReflectionNamedType; |
22 | 25 | use ReflectionParameter;
|
23 | 26 | use ReflectionProperty;
|
24 | 27 | use Reflector;
|
@@ -617,8 +620,9 @@ private static function getTypeFieldConfigurationFromReflector(ReflectionClass $
|
617 | 620 | $args = self::guessArgs($reflectionClass, $reflector, $args);
|
618 | 621 | }
|
619 | 622 |
|
620 |
| - if (!empty($args)) { |
621 |
| - $fieldConfiguration['args'] = $args; |
| 623 | + $gqlArgs = array_filter($args, fn ($arg) => !isset($arg['internal'])); |
| 624 | + if (!empty($gqlArgs)) { |
| 625 | + $fieldConfiguration['args'] = $gqlArgs; |
622 | 626 | }
|
623 | 627 |
|
624 | 628 | $fieldName = $fieldMetadata->name ?? $fieldName;
|
@@ -985,6 +989,14 @@ private static function guessArgs(
|
985 | 989 | continue;
|
986 | 990 | }
|
987 | 991 |
|
| 992 | + if ($parameter->getType() instanceof ReflectionNamedType) { |
| 993 | + $className = $parameter->getType()->getName(); |
| 994 | + if (ResolveInfo::class === $className || is_subclass_of($className, ResolveInfo::class)) { |
| 995 | + $arguments[$parameter->getName()] = ['type' => ArgumentsTransformer::RESOLVE_INFO_TOKEN, 'internal' => true]; |
| 996 | + continue; |
| 997 | + } |
| 998 | + } |
| 999 | + |
988 | 1000 | try {
|
989 | 1001 | $gqlType = self::guessType($reflectionClass, $parameter, self::VALID_INPUT_TYPES);
|
990 | 1002 | } catch (TypeGuessingException $exception) {
|
|
0 commit comments