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

Allow for passing rootValue #21

Merged
merged 1 commit into from
Apr 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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