1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is a part of graphql-youshido project. |
4
|
|
|
* |
5
|
|
|
* @author Alexandr Viniychuk <[email protected]> |
6
|
|
|
* created: 11/28/15 3:53 PM |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Youshido\GraphQL\Config\Schema; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
use Youshido\GraphQL\Config\AbstractConfig; |
13
|
|
|
use Youshido\GraphQL\Type\Object\AbstractObjectType; |
14
|
|
|
use Youshido\GraphQL\Type\Object\ObjectType; |
15
|
|
|
use Youshido\GraphQL\Type\TypeService; |
16
|
|
|
|
17
|
|
|
class SchemaConfig extends AbstractConfig |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
public function getRules() |
21
|
|
|
{ |
22
|
|
|
return [ |
23
|
|
|
'query' => ['type' => TypeService::TYPE_OBJECT_TYPE, 'required' => true], |
24
|
|
|
'mutation' => ['type' => TypeService::TYPE_OBJECT_TYPE], |
25
|
|
|
'name' => ['type' => TypeService::TYPE_STRING], |
26
|
|
|
]; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @return AbstractObjectType |
31
|
|
|
*/ |
32
|
37 |
|
public function getQuery() |
33
|
|
|
{ |
34
|
37 |
|
return $this->data['query']; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param $query AbstractObjectType |
39
|
|
|
* |
40
|
|
|
* @return SchemaConfig |
41
|
|
|
*/ |
42
|
7 |
|
public function setQuery($query) |
43
|
|
|
{ |
44
|
7 |
|
$this->data['query'] = $query; |
45
|
|
|
|
46
|
7 |
|
return $this; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return ObjectType |
51
|
|
|
*/ |
52
|
29 |
|
public function getMutation() |
53
|
|
|
{ |
54
|
29 |
|
return $this->get('mutation'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param $query AbstractObjectType |
59
|
|
|
* |
60
|
|
|
* @return SchemaConfig |
61
|
|
|
*/ |
62
|
|
|
public function setMutation($query) |
63
|
|
|
{ |
64
|
|
|
$this->data['mutation'] = $query; |
65
|
|
|
|
66
|
|
|
return $this; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function getName() |
70
|
|
|
{ |
71
|
|
|
return $this->get('name', 'RootSchema'); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
} |
76
|
|
|
|