|
1 | 1 | <?php
|
2 | 2 |
|
| 3 | +use GraphQL\Errors\ForbiddenError; |
3 | 4 | use GraphQL\Types\GraphQLObjectType;
|
4 | 5 | use GraphQL\Types\GraphQLEnum;
|
5 | 6 | use GraphQL\Types\GraphQLEnumValue;
|
|
30 | 31 | new GraphQLTypeField("name", new GraphQLString(), "The name of the character."),
|
31 | 32 | new GraphQLTypeField("friends", new GraphQLList($Character), "The friends of the character, or an empty list if they have none."),
|
32 | 33 | new GraphQLTypeField("appearsIn", new GraphQLList($Episode), "Which movies they appear in."),
|
| 34 | + new GraphQLTypeField("secretBackstory", new GraphQLString(), "All secrets about their past."), |
33 | 35 | ];
|
34 | 36 | }, function ($character) {
|
35 | 37 | if ($character["type"] === "human") {
|
|
51 | 53 | }, $character["friends"]);
|
52 | 54 | }),
|
53 | 55 | new GraphQLTypeField("appearsIn", new GraphQLList($Episode), "Which movies they appear in."),
|
54 |
| - new GraphQLTypeField("homePlanet", new GraphQLString(), "The home planet of the human, or null if unknown.") |
| 56 | + new GraphQLTypeField("homePlanet", new GraphQLString(), "The home planet of the human, or null if unknown."), |
| 57 | + new GraphQLTypeField("secretBackstory", new GraphQLString(), "Where are they from and how they came to be who they are.", function (){ |
| 58 | + throw new ForbiddenError("secretBackstory is secret."); |
| 59 | + }) |
55 | 60 | ];
|
56 | 61 | }, [
|
57 | 62 | $Character
|
|
70 | 75 | }, $character["friends"]);
|
71 | 76 | }),
|
72 | 77 | new GraphQLTypeField("appearsIn", new GraphQLList($Episode), "Which movies they appear in."),
|
73 |
| - new GraphQLTypeField("primaryFunction", new GraphQLString(), "The primary function of the droid.") |
| 78 | + new GraphQLTypeField("primaryFunction", new GraphQLString(), "The primary function of the droid."), |
| 79 | + new GraphQLTypeField("secretBackstory", new GraphQLString(), "Construction date and the name of the designer.", function (){ |
| 80 | + throw new ForbiddenError("secretBackstory is secret."); |
| 81 | + }) |
74 | 82 | ];
|
75 | 83 | }, [
|
76 | 84 | $Character
|
|
0 commit comments