-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresolvers.php
More file actions
47 lines (38 loc) · 1.92 KB
/
resolvers.php
File metadata and controls
47 lines (38 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
use GraphQL\Type\Definition\ResolveInfo;
use Neoxenos\PhpSimpleGraphqlBlog\Queries\Page;
require_once __DIR__ . '/vendor/autoload.php';
if (!function_exists('createResolvers')) {
function createResolvers(): array
{
$query = [
'PageBySlug' => function (?array $root, array $args, $context, ResolveInfo $info): array {
// var_dump($info->getFieldSelection()); selected fields to fetch: type Array
//var_dump($info->getFieldSelection()); exit;
return (new Page)->pageBySlug($args, $info->getFieldSelection());
},
'ListBlogByType' => function (?array $root, array $args, $context, ResolveInfo $info): array {
// var_dump($info->getFieldSelection()); selected fields to fetch: type Array
return (new Page)->pageBySlug($args, $info->getFieldSelection());
},
'ListBlogByCategories' => function (?array $root, array $args, $context, ResolveInfo $info): array {
// var_dump($info->getFieldSelection()); selected fields to fetch: type Array
return (new Page)->pageBySlug($args, $info->getFieldSelection());
},
'LisyTagsByPage' => function (?array $root, array $args, $context, ResolveInfo $info): array {
// var_dump($info->getFieldSelection()); selected fields to fetch: type Array
return (new Page)->pageBySlug($args, $info->getFieldSelection());
},
'Authors' => function (?array $root, array $args, $context, ResolveInfo $info): array {
// var_dump($info->getFieldSelection()); selected fields to fetch: type Array
return (new Page)->pageBySlug($args, $info->getFieldSelection());
},
];
$mutation = [];
return [
'Query' => $query,
'Mutation' => $mutation,
];
}
}