From 8e74280038c1aa750d0c82f5348cad108b90736a Mon Sep 17 00:00:00 2001 From: David Stoker Date: Wed, 27 Apr 2016 17:20:51 -0400 Subject: [PATCH] Allow for passing rootValue along with query instead of forcing to be null --- src/Schema/GraphQL.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Schema/GraphQL.php b/src/Schema/GraphQL.php index 396724d..e5a8234 100644 --- a/src/Schema/GraphQL.php +++ b/src/Schema/GraphQL.php @@ -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 [ @@ -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); } /**