Skip to content

Commit 0b90dcd

Browse files
committed
fix bugs in star wars example
1 parent 5ea3c85 commit 0b90dcd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/starwars/__data.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

33
$humans = [
4-
"1000" => ["type" => "human", "id" => "1000", "name" => "Luke Skywalker", "friends" => ["1002", "1003", "2000", "2001"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homeplanet" => "Tatooine"],
5-
"1001" => ["type" => "human", "id" => "1001", "name" => "Darth Vader", "friends" => ["1004"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homeplanet" => "Tatooine"],
4+
"1000" => ["type" => "human", "id" => "1000", "name" => "Luke Skywalker", "friends" => ["1002", "1003", "2000", "2001"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homePlanet" => "Tatooine"],
5+
"1001" => ["type" => "human", "id" => "1001", "name" => "Darth Vader", "friends" => ["1004"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homePlanet" => "Tatooine"],
66
"1002" => ["type" => "human", "id" => "1002", "name" => "Han Solo", "friends" => ["1000", "1003", "2001"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"]],
7-
"1003" => ["type" => "human", "id" => "1003", "name" => "Leia Organa", "friends" => ["1000", "1002", "2000", "2001"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homeplanet" => "Alderaan"],
7+
"1003" => ["type" => "human", "id" => "1003", "name" => "Leia Organa", "friends" => ["1000", "1002", "2000", "2001"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homePlanet" => "Alderaan"],
88
"1004" => ["type" => "human", "id" => "1004", "name" => "Wilhuff Tarkin", "friends" => ["1001"], "appearsIn" => ["NEW_HOPE"]],
99
];
1010

1111
$droids = [
1212
"2000" => ["type" => "droid", "id" => "2000", "name" => "C-3PO", "friends" => ["1000", "1002", "1003", "2001"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homeplanet" => "Protocol"],
13-
"2001" => ["type" => "droid", "id" => "2000", "name" => "R2-D2", "friends" => ["1000", "1002", "1003"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homeplanet" => "Astromech"],
13+
"2001" => ["type" => "droid", "id" => "2001", "name" => "R2-D2", "friends" => ["1000", "1002", "1003"], "appearsIn" => ["NEW_HOPE", "EMPIRE", "JEDI"], "homeplanet" => "Astromech"],
1414
];

examples/starwars/__schema.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@
8383
$Query = new GraphQLObjectType("Query", "Root Query", function () use (&$Episode, &$Character, &$Human, &$Droid, &$humans, &$droids) {
8484
return [
8585
new GraphQLTypeField("hero", $Character, "", function ($_, $args) use (&$humans, &$droids) {
86-
if (($args["episode"] ?? null) === "JEDI") {
86+
if (($args["episode"] ?? null) === "EMPIRE") {
8787
return $humans["1000"]; // Luke Skywalker
8888
}
89-
return $droids["2000"]; // R2-D2
89+
return $droids["2001"]; // R2-D2
9090
}, [
9191
new GraphQLFieldArgument("episode", $Episode, "If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode")
9292
]

0 commit comments

Comments
 (0)