@@ -31,85 +31,85 @@ |
||
31 | 31 | class EventEditorDataResolver extends ResolverBase |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * @var EEM_Datetime $datetime_model |
|
36 | - */ |
|
37 | - protected $datetime_model; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var RestApiSpoofer $converter |
|
41 | - */ |
|
42 | - protected $spoofer; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * EventEditorEntities constructor. |
|
47 | - * |
|
48 | - * @param EEM_Datetime $datetime_model |
|
49 | - * @param RestApiSpoofer $spoofer |
|
50 | - */ |
|
51 | - public function __construct(EEM_Datetime $datetime_model, RestApiSpoofer $spoofer) |
|
52 | - { |
|
53 | - $this->datetime_model = $datetime_model; |
|
54 | - $this->spoofer = $spoofer; |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * @return string |
|
60 | - * @since $VID:$ |
|
61 | - */ |
|
62 | - public function query() |
|
63 | - { |
|
64 | - return 'Event'; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * @return string |
|
70 | - * @since $VID:$ |
|
71 | - */ |
|
72 | - public function field() |
|
73 | - { |
|
74 | - return 'eventDates'; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @return string |
|
80 | - * @since $VID:$ |
|
81 | - */ |
|
82 | - public function type() |
|
83 | - { |
|
84 | - return 'String'; |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @param Post $post |
|
90 | - * @param array $args |
|
91 | - * @param AppContext $context |
|
92 | - * @param ResolveInfo $info |
|
93 | - * @return string |
|
94 | - * @throws EE_Error |
|
95 | - * @throws InvalidArgumentException |
|
96 | - * @throws InvalidDataTypeException |
|
97 | - * @throws InvalidInterfaceException |
|
98 | - * @throws ReflectionException |
|
99 | - * @throws ModelConfigurationException |
|
100 | - * @throws RestPasswordIncorrectException |
|
101 | - * @throws RestPasswordRequiredException |
|
102 | - * @throws UnexpectedEntityException |
|
103 | - * @throws RestException |
|
104 | - * @since $VID:$ |
|
105 | - */ |
|
106 | - public function resolve($post, array $args, AppContext $context, ResolveInfo $info) |
|
107 | - { |
|
108 | - return $post instanceof Post |
|
109 | - ? wp_json_encode($this->spoofer->getApiResults( |
|
110 | - $this->datetime_model, |
|
111 | - [['EVT_ID' => $post->ID]] |
|
112 | - )) |
|
113 | - : '{}'; |
|
114 | - } |
|
34 | + /** |
|
35 | + * @var EEM_Datetime $datetime_model |
|
36 | + */ |
|
37 | + protected $datetime_model; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var RestApiSpoofer $converter |
|
41 | + */ |
|
42 | + protected $spoofer; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * EventEditorEntities constructor. |
|
47 | + * |
|
48 | + * @param EEM_Datetime $datetime_model |
|
49 | + * @param RestApiSpoofer $spoofer |
|
50 | + */ |
|
51 | + public function __construct(EEM_Datetime $datetime_model, RestApiSpoofer $spoofer) |
|
52 | + { |
|
53 | + $this->datetime_model = $datetime_model; |
|
54 | + $this->spoofer = $spoofer; |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * @return string |
|
60 | + * @since $VID:$ |
|
61 | + */ |
|
62 | + public function query() |
|
63 | + { |
|
64 | + return 'Event'; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * @return string |
|
70 | + * @since $VID:$ |
|
71 | + */ |
|
72 | + public function field() |
|
73 | + { |
|
74 | + return 'eventDates'; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @return string |
|
80 | + * @since $VID:$ |
|
81 | + */ |
|
82 | + public function type() |
|
83 | + { |
|
84 | + return 'String'; |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @param Post $post |
|
90 | + * @param array $args |
|
91 | + * @param AppContext $context |
|
92 | + * @param ResolveInfo $info |
|
93 | + * @return string |
|
94 | + * @throws EE_Error |
|
95 | + * @throws InvalidArgumentException |
|
96 | + * @throws InvalidDataTypeException |
|
97 | + * @throws InvalidInterfaceException |
|
98 | + * @throws ReflectionException |
|
99 | + * @throws ModelConfigurationException |
|
100 | + * @throws RestPasswordIncorrectException |
|
101 | + * @throws RestPasswordRequiredException |
|
102 | + * @throws UnexpectedEntityException |
|
103 | + * @throws RestException |
|
104 | + * @since $VID:$ |
|
105 | + */ |
|
106 | + public function resolve($post, array $args, AppContext $context, ResolveInfo $info) |
|
107 | + { |
|
108 | + return $post instanceof Post |
|
109 | + ? wp_json_encode($this->spoofer->getApiResults( |
|
110 | + $this->datetime_model, |
|
111 | + [['EVT_ID' => $post->ID]] |
|
112 | + )) |
|
113 | + : '{}'; |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | \ No newline at end of file |