From b3eada4a8a211e497703fb8ab1d3963c3274a48e Mon Sep 17 00:00:00 2001 From: Guy Mac Date: Sun, 12 May 2019 21:53:49 +0100 Subject: [PATCH] Add operation factory --- src/EntitySchemaBuilder.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/EntitySchemaBuilder.php b/src/EntitySchemaBuilder.php index 5dbef9c..f880792 100644 --- a/src/EntitySchemaBuilder.php +++ b/src/EntitySchemaBuilder.php @@ -8,6 +8,7 @@ use GraphQL\Doctrine\DefaultFieldResolver; use GraphQL\Doctrine\Types; use GraphQL\GraphQL; +use GraphQL\Server\OperationParams; use GraphQL\Server\ServerConfig; use GraphQL\Server\StandardServer; use GraphQL\Type\Definition\ObjectType; @@ -462,4 +463,11 @@ public function mutation(string $name): Mutation { $this->mutators[$name] = $mutation; return $mutation; } -} \ No newline at end of file + + public static function createServerOperation(array $json): OperationParams { + return OperationParams::create([ + 'query' => $json['query'], + 'variables' => $json['variabes'] ?? null, + ]); + } +}