@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | //require_once __DIR__ . '/../../vendor/autoload.php'; |
| 13 | 13 | //require_once __DIR__ . '/Schema/PostType.php'; // including PostType definition |
| 14 | 14 | |
| 15 | -require_once __DIR__ .'/schema-bootstrap.php'; |
|
| 15 | +require_once __DIR__.'/schema-bootstrap.php'; |
|
| 16 | 16 | |
| 17 | 17 | $rootQueryType = new ObjectType([ |
| 18 | 18 | 'name' => 'RootQueryType', |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | ] |
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | -$rootMutationType = new ObjectType([ |
|
| 25 | +$rootMutationType = new ObjectType([ |
|
| 26 | 26 | 'name' => 'RootMutationType', |
| 27 | 27 | 'fields' => [ |
| 28 | 28 | 'likePost' => [ |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | 'args' => [ |
| 31 | 31 | 'id' => new NonNullType(new IntType()) |
| 32 | 32 | ], |
| 33 | - 'resolve' => function ($value, $args, $type) { |
|
| 33 | + 'resolve' => function($value, $args, $type) { |
|
| 34 | 34 | // adding like count code goes here |
| 35 | 35 | return [ |
| 36 | - 'title' => 'Title for the post #' . $args['id'], |
|
| 36 | + 'title' => 'Title for the post #'.$args['id'], |
|
| 37 | 37 | 'summary' => 'We can now get a richer response from the mutation', |
| 38 | 38 | 'likeCount' => 2 |
| 39 | 39 | ]; |
@@ -49,6 +49,6 @@ discard block |
||
| 49 | 49 | 'mutation' => $rootMutationType, |
| 50 | 50 | ])); |
| 51 | 51 | |
| 52 | -$payload = 'mutation { likePost(id:5) }'; |
|
| 52 | +$payload = 'mutation { likePost(id:5) }'; |
|
| 53 | 53 | $processor->processRequest($payload); |
| 54 | -echo json_encode($processor->getResponseData()) . "\n"; |
|
| 54 | +echo json_encode($processor->getResponseData())."\n"; |
|