diff --git a/src/Config/Parser/AnnotationParser.php b/src/Config/Parser/AnnotationParser.php index a80f193c4..ccf9ef9e7 100644 --- a/src/Config/Parser/AnnotationParser.php +++ b/src/Config/Parser/AnnotationParser.php @@ -357,7 +357,7 @@ private static function getGraphqlFieldsFromAnnotations(array $annotations, bool $fieldConfiguration['resolve'] = self::formatExpression($fieldAnnotation->resolve); } else { if ($isMethod) { - $fieldConfiguration['resolve'] = self::formatExpression(\sprintf("value_resolver([%s], '%s')", \implode(', ', $args), $target)); + $fieldConfiguration['resolve'] = self::formatExpression(\sprintf('value.%s(%s)', $target, \implode(', ', $args))); } elseif ($fieldAnnotation->name) { $fieldConfiguration['resolve'] = self::formatExpression(\sprintf('value.%s', $target)); } diff --git a/src/ExpressionLanguage/ExpressionFunction/GraphQL/ValueResolver.php b/src/ExpressionLanguage/ExpressionFunction/GraphQL/ValueResolver.php deleted file mode 100644 index b387c0e74..000000000 --- a/src/ExpressionLanguage/ExpressionFunction/GraphQL/ValueResolver.php +++ /dev/null @@ -1,20 +0,0 @@ -fieldName', $args); - } - ); - } -} diff --git a/src/Resources/config/expression_language_functions.yml b/src/Resources/config/expression_language_functions.yml index 42245d26e..335f98c7e 100644 --- a/src/Resources/config/expression_language_functions.yml +++ b/src/Resources/config/expression_language_functions.yml @@ -85,12 +85,6 @@ services: tags: - { name: overblog_graphql.expression_function } - Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\GraphQL\ValueResolver: - class: Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\GraphQL\ValueResolver - public: false - tags: - - { name: overblog_graphql.expression_function } - Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\NewObject: class: Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\NewObject public: false diff --git a/tests/Config/Parser/AnnotationParserTest.php b/tests/Config/Parser/AnnotationParserTest.php index be4363efc..7cd36d228 100644 --- a/tests/Config/Parser/AnnotationParserTest.php +++ b/tests/Config/Parser/AnnotationParserTest.php @@ -189,13 +189,12 @@ public function testFieldMethod(): void 'gender' => ['type' => 'Gender', 'description' => 'Limit friends of this gender'], 'limit' => ['type' => 'Int', 'description' => 'Limit number of friends to retrieve'], ], - 'resolve' => "@=value_resolver([args['gender'], args['limit']], 'getFriends')", + 'resolve' => "@=value.getFriends(args['gender'], args['limit'])", ], ], ], ], ]; - $this->checkConfigFromFile('Fields/FieldMethod.php', $expected); } @@ -212,7 +211,7 @@ public function testFieldArgsBuilder(): void 'builder' => 'MyArgBuilder', 'config' => ['defaultArg' => 1, 'option2' => 'smile'], ], - 'resolve' => "@=value_resolver([], 'getFriends')", + 'resolve' => '@=value.getFriends()', ], 'planets' => [ 'argsBuilder' => 'MyArgBuilder', @@ -221,7 +220,6 @@ public function testFieldArgsBuilder(): void ], ], ]; - $this->checkConfigFromFile('Fields/FieldArgsBuilder.php', $expected); } @@ -241,7 +239,6 @@ public function testFieldFieldBuilder(): void ], ], ]; - $this->checkConfigFromFile('Fields/FieldFieldBuilder.php', $expected); } @@ -256,7 +253,6 @@ public function testExtends(): void ], ], ]]]; - $this->checkConfigFromFile('Inherits/ChildClass.php', $expected); } }