Skip to content

Commit 841d6ab

Browse files
committed
Updated to latest version of graphql-js
1 parent 022c962 commit 841d6ab

File tree

88 files changed

+3214
-1656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3214
-1656
lines changed

src/Executor/ExecutionContext.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace GraphQL\Executor;
33

4+
use GraphQL\Error;
45
use GraphQL\Language\AST\OperationDefinition;
56
use GraphQL\Schema;
67

@@ -25,7 +26,7 @@ class ExecutionContext
2526
/**
2627
* @var
2728
*/
28-
public $root;
29+
public $rootValue;
2930

3031
/**
3132
* @var OperationDefinition
@@ -35,7 +36,7 @@ class ExecutionContext
3536
/**
3637
* @var array
3738
*/
38-
public $variables;
39+
public $variableValues;
3940

4041
/**
4142
* @var array
@@ -46,13 +47,13 @@ public function __construct($schema, $fragments, $root, $operation, $variables,
4647
{
4748
$this->schema = $schema;
4849
$this->fragments = $fragments;
49-
$this->root = $root;
50+
$this->rootValue = $root;
5051
$this->operation = $operation;
51-
$this->variables = $variables;
52+
$this->variableValues = $variables;
5253
$this->errors = $errors ?: [];
5354
}
5455

55-
public function addError($error)
56+
public function addError(Error $error)
5657
{
5758
$this->errors[] = $error;
5859
return $this;

src/Executor/ExecutionResult.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
namespace GraphQL\Executor;
3+
4+
use GraphQL\Error;
5+
6+
class ExecutionResult
7+
{
8+
/**
9+
* @var array
10+
*/
11+
public $data;
12+
13+
/**
14+
* @var Error[]
15+
*/
16+
public $errors;
17+
18+
/**
19+
* @param array $data
20+
* @param array $errors
21+
*/
22+
public function __construct(array $data = null, array $errors = [])
23+
{
24+
$this->data = $data;
25+
$this->errors = $errors;
26+
}
27+
28+
public function toArray()
29+
{
30+
$result = ['data' => $this->data];
31+
32+
if (!empty($this->errors)) {
33+
$result['errors'] = array_map(['GraphQL\Error', 'formatError'], $this->errors);
34+
}
35+
36+
return $result;
37+
}
38+
}

0 commit comments

Comments
 (0)