Skip to content

Commit

Permalink
Remove useless resolver et fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincz committed Oct 15, 2018
1 parent 4e09e47 commit 4031155
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Config/Parser/AnnotationParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions src/Resources/config/expression_language_functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions tests/Config/Parser/AnnotationParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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',
Expand All @@ -221,7 +220,6 @@ public function testFieldArgsBuilder(): void
],
],
];

$this->checkConfigFromFile('Fields/FieldArgsBuilder.php', $expected);
}

Expand All @@ -241,7 +239,6 @@ public function testFieldFieldBuilder(): void
],
],
];

$this->checkConfigFromFile('Fields/FieldFieldBuilder.php', $expected);
}

Expand All @@ -256,7 +253,6 @@ public function testExtends(): void
],
],
]]];

$this->checkConfigFromFile('Inherits/ChildClass.php', $expected);
}
}

0 comments on commit 4031155

Please sign in to comment.