Skip to content
This repository was archived by the owner on Mar 29, 2020. It is now read-only.

Commit 2f148dd

Browse files
committed
Merge pull request #21 from davidstoker/add-root-value
Allow for passing rootValue
2 parents 10cb2c5 + 8e74280 commit 2f148dd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Schema/GraphQL.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ public function __construct($app)
9898
*
9999
* @param string $query
100100
* @param array $variables
101+
* @param mixed $rootValue
101102
* @return array
102103
*/
103-
public function query($query, $variables = [])
104+
public function query($query, $variables = [], $rootValue = null)
104105
{
105-
$result = $this->queryAndReturnResult($query, $variables);
106+
$result = $this->queryAndReturnResult($query, $variables, $rootValue);
106107

107108
if (!empty($result->errors)) {
108109
return [
@@ -119,11 +120,12 @@ public function query($query, $variables = [])
119120
*
120121
* @param string $query
121122
* @param array $variables
123+
* @param mixed $rootValue
122124
* @return array
123125
*/
124-
public function queryAndReturnResult($query, $variables = [])
126+
public function queryAndReturnResult($query, $variables = [], $rootValue = null)
125127
{
126-
return GraphQLBase::executeAndReturnResult($this->schema(), $query, null, $variables);
128+
return GraphQLBase::executeAndReturnResult($this->schema(), $query, $rootValue, $variables);
127129
}
128130

129131
/**

0 commit comments

Comments
 (0)