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

Commit

Permalink
Merge pull request #21 from davidstoker/add-root-value
Browse files Browse the repository at this point in the history
Allow for passing rootValue
  • Loading branch information
chrissm79 committed Apr 27, 2016
2 parents 10cb2c5 + 8e74280 commit 2f148dd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Schema/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ public function __construct($app)
*
* @param string $query
* @param array $variables
* @param mixed $rootValue
* @return array
*/
public function query($query, $variables = [])
public function query($query, $variables = [], $rootValue = null)
{
$result = $this->queryAndReturnResult($query, $variables);
$result = $this->queryAndReturnResult($query, $variables, $rootValue);

if (!empty($result->errors)) {
return [
Expand All @@ -119,11 +120,12 @@ public function query($query, $variables = [])
*
* @param string $query
* @param array $variables
* @param mixed $rootValue
* @return array
*/
public function queryAndReturnResult($query, $variables = [])
public function queryAndReturnResult($query, $variables = [], $rootValue = null)
{
return GraphQLBase::executeAndReturnResult($this->schema(), $query, null, $variables);
return GraphQLBase::executeAndReturnResult($this->schema(), $query, $rootValue, $variables);
}

/**
Expand Down

0 comments on commit 2f148dd

Please sign in to comment.