@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | // Register mutation to update an entity. |
225 | 225 | register_graphql_mutation( |
226 | - 'update' . $this->name(), |
|
226 | + 'update'.$this->name(), |
|
227 | 227 | [ |
228 | 228 | 'inputFields' => $inputFields, |
229 | 229 | 'outputFields' => [ |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ); |
238 | 238 | // Register mutation to delete an entity. |
239 | 239 | register_graphql_mutation( |
240 | - 'delete' . $this->name(), |
|
240 | + 'delete'.$this->name(), |
|
241 | 241 | [ |
242 | 242 | 'inputFields' => [ |
243 | 243 | 'id' => $inputFields['id'], |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | lcfirst($this->name()) => [ |
251 | 251 | 'type' => $this->name(), |
252 | 252 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
253 | - 'resolve' => static function ($payload) { |
|
253 | + 'resolve' => static function($payload) { |
|
254 | 254 | $deleted = (object) $payload['deleted']; |
255 | 255 | |
256 | 256 | return ! empty($deleted) ? $deleted : null; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | unset($inputFields['id']); |
266 | 266 | // Register mutation to update an entity. |
267 | 267 | register_graphql_mutation( |
268 | - 'create' . $this->name(), |
|
268 | + 'create'.$this->name(), |
|
269 | 269 | [ |
270 | 270 | 'inputFields' => $inputFields, |
271 | 271 | 'outputFields' => [ |
@@ -25,285 +25,285 @@ |
||
25 | 25 | class Ticket extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Ticket constructor. |
|
30 | - * |
|
31 | - * @param EEM_Ticket $ticket_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Ticket $ticket_model) |
|
34 | - { |
|
35 | - $this->model = $ticket_model; |
|
36 | - $this->setName('Ticket'); |
|
37 | - $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
28 | + /** |
|
29 | + * Ticket constructor. |
|
30 | + * |
|
31 | + * @param EEM_Ticket $ticket_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Ticket $ticket_model) |
|
34 | + { |
|
35 | + $this->model = $ticket_model; |
|
36 | + $this->setName('Ticket'); |
|
37 | + $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
38 | + $this->setIsCustomPostType(false); |
|
39 | + parent::__construct(); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @return GraphQLFieldInterface[] |
|
45 | - * @since $VID:$ |
|
46 | - */ |
|
47 | - public function getFields() |
|
48 | - { |
|
49 | - return [ |
|
50 | - new GraphQLField( |
|
51 | - 'id', |
|
52 | - ['non_null' => 'ID'], |
|
53 | - null, |
|
54 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | - ), |
|
56 | - new GraphQLOutputField( |
|
57 | - 'dbId', |
|
58 | - ['non_null' => 'Int'], |
|
59 | - 'ID', |
|
60 | - esc_html__('Ticket ID', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'name', |
|
64 | - 'String', |
|
65 | - 'name', |
|
66 | - esc_html__('Ticket Name', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'description', |
|
70 | - 'String', |
|
71 | - 'description', |
|
72 | - esc_html__('Description of Ticket', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'startDate', |
|
76 | - 'String', |
|
77 | - 'start_date', |
|
78 | - esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
79 | - [$this, 'formatDatetime'] |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'endDate', |
|
83 | - 'String', |
|
84 | - 'end_date', |
|
85 | - esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
86 | - [$this, 'formatDatetime'] |
|
87 | - ), |
|
88 | - new GraphQLField( |
|
89 | - 'min', |
|
90 | - 'Int', |
|
91 | - 'min', |
|
92 | - esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
93 | - ), |
|
94 | - new GraphQLField( |
|
95 | - 'max', |
|
96 | - 'Int', |
|
97 | - 'max', |
|
98 | - esc_html__( |
|
99 | - 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
100 | - 'event_espresso' |
|
101 | - ), |
|
102 | - [$this, 'parseInfiniteValue'] |
|
103 | - ), |
|
104 | - new GraphQLField( |
|
105 | - 'price', |
|
106 | - 'Float', |
|
107 | - 'price', |
|
108 | - esc_html__('Final calculated price for ticket', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLField( |
|
111 | - 'sold', |
|
112 | - 'Int', |
|
113 | - 'sold', |
|
114 | - esc_html__('Number of this ticket sold', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLField( |
|
117 | - 'quantity', |
|
118 | - 'Int', |
|
119 | - 'qty', |
|
120 | - esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
121 | - [$this, 'parseInfiniteValue'] |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'reserved', |
|
125 | - 'Int', |
|
126 | - 'reserved', |
|
127 | - esc_html__( |
|
128 | - 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
129 | - 'event_espresso' |
|
130 | - ) |
|
131 | - ), |
|
132 | - new GraphQLField( |
|
133 | - 'uses', |
|
134 | - 'Int', |
|
135 | - 'uses', |
|
136 | - esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
137 | - [$this, 'parseInfiniteValue'] |
|
138 | - ), |
|
139 | - new GraphQLField( |
|
140 | - 'isRequired', |
|
141 | - 'Boolean', |
|
142 | - 'required', |
|
143 | - esc_html__( |
|
144 | - 'Flag indicating whether this ticket must be purchased with a transaction', |
|
145 | - 'event_espresso' |
|
146 | - ) |
|
147 | - ), |
|
148 | - new GraphQLField( |
|
149 | - 'isTaxable', |
|
150 | - 'Boolean', |
|
151 | - 'taxable', |
|
152 | - esc_html__( |
|
153 | - 'Flag indicating whether there is tax applied on this ticket', |
|
154 | - 'event_espresso' |
|
155 | - ) |
|
156 | - ), |
|
157 | - new GraphQLField( |
|
158 | - 'isDefault', |
|
159 | - 'Boolean', |
|
160 | - 'is_default', |
|
161 | - esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
162 | - ), |
|
163 | - new GraphQLField( |
|
164 | - 'order', |
|
165 | - 'Int', |
|
166 | - 'order', |
|
167 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
168 | - ), |
|
169 | - new GraphQLField( |
|
170 | - 'row', |
|
171 | - 'Int', |
|
172 | - 'row', |
|
173 | - esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
174 | - ), |
|
175 | - new GraphQLOutputField( |
|
176 | - 'wpUser', |
|
177 | - 'User', |
|
178 | - null, |
|
179 | - esc_html__('Ticket Creator', 'event_espresso') |
|
180 | - ), |
|
181 | - new GraphQLInputField( |
|
182 | - 'wpUser', |
|
183 | - 'Int', |
|
184 | - null, |
|
185 | - esc_html__('Ticket Creator ID', 'event_espresso') |
|
186 | - ), |
|
187 | - new GraphQLOutputField( |
|
188 | - 'parent', |
|
189 | - $this->name(), |
|
190 | - null, |
|
191 | - esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
192 | - ), |
|
193 | - new GraphQLInputField( |
|
194 | - 'parent', |
|
195 | - 'ID', |
|
196 | - null, |
|
197 | - esc_html__('The parent ticket ID', 'event_espresso') |
|
198 | - ), |
|
199 | - new GraphQLField( |
|
200 | - 'reverseCalculate', |
|
201 | - 'Boolean', |
|
202 | - 'reverse_calculate', |
|
203 | - esc_html__( |
|
204 | - 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
205 | - 'event_espresso' |
|
206 | - ) |
|
207 | - ), |
|
208 | - new GraphQLField( |
|
209 | - 'isFree', |
|
210 | - 'Boolean', |
|
211 | - 'is_free', |
|
212 | - esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
213 | - ), |
|
214 | - new GraphQLOutputField( |
|
215 | - 'event', |
|
216 | - 'Event', |
|
217 | - null, |
|
218 | - esc_html__('Event of the ticket.', 'event_espresso') |
|
219 | - ), |
|
220 | - new GraphQLInputField( |
|
221 | - 'datetimes', |
|
222 | - ['list_of' => 'ID'], |
|
223 | - null, |
|
224 | - sprintf( |
|
225 | - '%1$s %2$s', |
|
226 | - esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
227 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
228 | - ) |
|
229 | - ), |
|
230 | - new GraphQLInputField( |
|
231 | - 'prices', |
|
232 | - ['list_of' => 'ID'], |
|
233 | - null, |
|
234 | - sprintf( |
|
235 | - '%1$s %2$s', |
|
236 | - esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
237 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
238 | - ) |
|
239 | - ), |
|
240 | - ]; |
|
241 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
50 | + new GraphQLField( |
|
51 | + 'id', |
|
52 | + ['non_null' => 'ID'], |
|
53 | + null, |
|
54 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | + ), |
|
56 | + new GraphQLOutputField( |
|
57 | + 'dbId', |
|
58 | + ['non_null' => 'Int'], |
|
59 | + 'ID', |
|
60 | + esc_html__('Ticket ID', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'name', |
|
64 | + 'String', |
|
65 | + 'name', |
|
66 | + esc_html__('Ticket Name', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'description', |
|
70 | + 'String', |
|
71 | + 'description', |
|
72 | + esc_html__('Description of Ticket', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'startDate', |
|
76 | + 'String', |
|
77 | + 'start_date', |
|
78 | + esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
79 | + [$this, 'formatDatetime'] |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'endDate', |
|
83 | + 'String', |
|
84 | + 'end_date', |
|
85 | + esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
86 | + [$this, 'formatDatetime'] |
|
87 | + ), |
|
88 | + new GraphQLField( |
|
89 | + 'min', |
|
90 | + 'Int', |
|
91 | + 'min', |
|
92 | + esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
93 | + ), |
|
94 | + new GraphQLField( |
|
95 | + 'max', |
|
96 | + 'Int', |
|
97 | + 'max', |
|
98 | + esc_html__( |
|
99 | + 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
100 | + 'event_espresso' |
|
101 | + ), |
|
102 | + [$this, 'parseInfiniteValue'] |
|
103 | + ), |
|
104 | + new GraphQLField( |
|
105 | + 'price', |
|
106 | + 'Float', |
|
107 | + 'price', |
|
108 | + esc_html__('Final calculated price for ticket', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLField( |
|
111 | + 'sold', |
|
112 | + 'Int', |
|
113 | + 'sold', |
|
114 | + esc_html__('Number of this ticket sold', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLField( |
|
117 | + 'quantity', |
|
118 | + 'Int', |
|
119 | + 'qty', |
|
120 | + esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
121 | + [$this, 'parseInfiniteValue'] |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'reserved', |
|
125 | + 'Int', |
|
126 | + 'reserved', |
|
127 | + esc_html__( |
|
128 | + 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
129 | + 'event_espresso' |
|
130 | + ) |
|
131 | + ), |
|
132 | + new GraphQLField( |
|
133 | + 'uses', |
|
134 | + 'Int', |
|
135 | + 'uses', |
|
136 | + esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
137 | + [$this, 'parseInfiniteValue'] |
|
138 | + ), |
|
139 | + new GraphQLField( |
|
140 | + 'isRequired', |
|
141 | + 'Boolean', |
|
142 | + 'required', |
|
143 | + esc_html__( |
|
144 | + 'Flag indicating whether this ticket must be purchased with a transaction', |
|
145 | + 'event_espresso' |
|
146 | + ) |
|
147 | + ), |
|
148 | + new GraphQLField( |
|
149 | + 'isTaxable', |
|
150 | + 'Boolean', |
|
151 | + 'taxable', |
|
152 | + esc_html__( |
|
153 | + 'Flag indicating whether there is tax applied on this ticket', |
|
154 | + 'event_espresso' |
|
155 | + ) |
|
156 | + ), |
|
157 | + new GraphQLField( |
|
158 | + 'isDefault', |
|
159 | + 'Boolean', |
|
160 | + 'is_default', |
|
161 | + esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
162 | + ), |
|
163 | + new GraphQLField( |
|
164 | + 'order', |
|
165 | + 'Int', |
|
166 | + 'order', |
|
167 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
168 | + ), |
|
169 | + new GraphQLField( |
|
170 | + 'row', |
|
171 | + 'Int', |
|
172 | + 'row', |
|
173 | + esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
174 | + ), |
|
175 | + new GraphQLOutputField( |
|
176 | + 'wpUser', |
|
177 | + 'User', |
|
178 | + null, |
|
179 | + esc_html__('Ticket Creator', 'event_espresso') |
|
180 | + ), |
|
181 | + new GraphQLInputField( |
|
182 | + 'wpUser', |
|
183 | + 'Int', |
|
184 | + null, |
|
185 | + esc_html__('Ticket Creator ID', 'event_espresso') |
|
186 | + ), |
|
187 | + new GraphQLOutputField( |
|
188 | + 'parent', |
|
189 | + $this->name(), |
|
190 | + null, |
|
191 | + esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
192 | + ), |
|
193 | + new GraphQLInputField( |
|
194 | + 'parent', |
|
195 | + 'ID', |
|
196 | + null, |
|
197 | + esc_html__('The parent ticket ID', 'event_espresso') |
|
198 | + ), |
|
199 | + new GraphQLField( |
|
200 | + 'reverseCalculate', |
|
201 | + 'Boolean', |
|
202 | + 'reverse_calculate', |
|
203 | + esc_html__( |
|
204 | + 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
205 | + 'event_espresso' |
|
206 | + ) |
|
207 | + ), |
|
208 | + new GraphQLField( |
|
209 | + 'isFree', |
|
210 | + 'Boolean', |
|
211 | + 'is_free', |
|
212 | + esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
213 | + ), |
|
214 | + new GraphQLOutputField( |
|
215 | + 'event', |
|
216 | + 'Event', |
|
217 | + null, |
|
218 | + esc_html__('Event of the ticket.', 'event_espresso') |
|
219 | + ), |
|
220 | + new GraphQLInputField( |
|
221 | + 'datetimes', |
|
222 | + ['list_of' => 'ID'], |
|
223 | + null, |
|
224 | + sprintf( |
|
225 | + '%1$s %2$s', |
|
226 | + esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
227 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
228 | + ) |
|
229 | + ), |
|
230 | + new GraphQLInputField( |
|
231 | + 'prices', |
|
232 | + ['list_of' => 'ID'], |
|
233 | + null, |
|
234 | + sprintf( |
|
235 | + '%1$s %2$s', |
|
236 | + esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
237 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
238 | + ) |
|
239 | + ), |
|
240 | + ]; |
|
241 | + } |
|
242 | 242 | |
243 | 243 | |
244 | - /** |
|
245 | - * @param array $inputFields The mutation input fields. |
|
246 | - * @throws InvalidArgumentException |
|
247 | - * @throws ReflectionException |
|
248 | - * @since $VID:$ |
|
249 | - */ |
|
250 | - public function registerMutations(array $inputFields) |
|
251 | - { |
|
252 | - // Register mutation to update an entity. |
|
253 | - register_graphql_mutation( |
|
254 | - 'update' . $this->name(), |
|
255 | - [ |
|
256 | - 'inputFields' => $inputFields, |
|
257 | - 'outputFields' => [ |
|
258 | - lcfirst($this->name()) => [ |
|
259 | - 'type' => $this->name(), |
|
260 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
261 | - ], |
|
262 | - ], |
|
263 | - 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
264 | - ] |
|
265 | - ); |
|
266 | - // Register mutation to delete an entity. |
|
267 | - register_graphql_mutation( |
|
268 | - 'delete' . $this->name(), |
|
269 | - [ |
|
270 | - 'inputFields' => [ |
|
271 | - 'id' => $inputFields['id'], |
|
272 | - 'deletePermanently' => [ |
|
273 | - 'type' => 'Boolean', |
|
274 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
275 | - ], |
|
276 | - ], |
|
277 | - 'outputFields' => [ |
|
278 | - lcfirst($this->name()) => [ |
|
279 | - 'type' => $this->name(), |
|
280 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
281 | - 'resolve' => static function ($payload) { |
|
282 | - $deleted = (object) $payload['deleted']; |
|
244 | + /** |
|
245 | + * @param array $inputFields The mutation input fields. |
|
246 | + * @throws InvalidArgumentException |
|
247 | + * @throws ReflectionException |
|
248 | + * @since $VID:$ |
|
249 | + */ |
|
250 | + public function registerMutations(array $inputFields) |
|
251 | + { |
|
252 | + // Register mutation to update an entity. |
|
253 | + register_graphql_mutation( |
|
254 | + 'update' . $this->name(), |
|
255 | + [ |
|
256 | + 'inputFields' => $inputFields, |
|
257 | + 'outputFields' => [ |
|
258 | + lcfirst($this->name()) => [ |
|
259 | + 'type' => $this->name(), |
|
260 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
261 | + ], |
|
262 | + ], |
|
263 | + 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
264 | + ] |
|
265 | + ); |
|
266 | + // Register mutation to delete an entity. |
|
267 | + register_graphql_mutation( |
|
268 | + 'delete' . $this->name(), |
|
269 | + [ |
|
270 | + 'inputFields' => [ |
|
271 | + 'id' => $inputFields['id'], |
|
272 | + 'deletePermanently' => [ |
|
273 | + 'type' => 'Boolean', |
|
274 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
275 | + ], |
|
276 | + ], |
|
277 | + 'outputFields' => [ |
|
278 | + lcfirst($this->name()) => [ |
|
279 | + 'type' => $this->name(), |
|
280 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
281 | + 'resolve' => static function ($payload) { |
|
282 | + $deleted = (object) $payload['deleted']; |
|
283 | 283 | |
284 | - return ! empty($deleted) ? $deleted : null; |
|
285 | - }, |
|
286 | - ], |
|
287 | - ], |
|
288 | - 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
289 | - ] |
|
290 | - ); |
|
284 | + return ! empty($deleted) ? $deleted : null; |
|
285 | + }, |
|
286 | + ], |
|
287 | + ], |
|
288 | + 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
289 | + ] |
|
290 | + ); |
|
291 | 291 | |
292 | - // remove primary key from input. |
|
293 | - unset($inputFields['id']); |
|
294 | - // Register mutation to update an entity. |
|
295 | - register_graphql_mutation( |
|
296 | - 'create' . $this->name(), |
|
297 | - [ |
|
298 | - 'inputFields' => $inputFields, |
|
299 | - 'outputFields' => [ |
|
300 | - lcfirst($this->name()) => [ |
|
301 | - 'type' => $this->name(), |
|
302 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
303 | - ], |
|
304 | - ], |
|
305 | - 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
306 | - ] |
|
307 | - ); |
|
308 | - } |
|
292 | + // remove primary key from input. |
|
293 | + unset($inputFields['id']); |
|
294 | + // Register mutation to update an entity. |
|
295 | + register_graphql_mutation( |
|
296 | + 'create' . $this->name(), |
|
297 | + [ |
|
298 | + 'inputFields' => $inputFields, |
|
299 | + 'outputFields' => [ |
|
300 | + lcfirst($this->name()) => [ |
|
301 | + 'type' => $this->name(), |
|
302 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
303 | + ], |
|
304 | + ], |
|
305 | + 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
306 | + ] |
|
307 | + ); |
|
308 | + } |
|
309 | 309 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | // Register mutation to update an entity. |
225 | 225 | register_graphql_mutation( |
226 | - 'update' . $this->name(), |
|
226 | + 'update'.$this->name(), |
|
227 | 227 | [ |
228 | 228 | 'inputFields' => $inputFields, |
229 | 229 | 'outputFields' => [ |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ); |
238 | 238 | // Register mutation to delete an entity. |
239 | 239 | register_graphql_mutation( |
240 | - 'delete' . $this->name(), |
|
240 | + 'delete'.$this->name(), |
|
241 | 241 | [ |
242 | 242 | 'inputFields' => [ |
243 | 243 | 'id' => $inputFields['id'], |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | lcfirst($this->name()) => [ |
251 | 251 | 'type' => $this->name(), |
252 | 252 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
253 | - 'resolve' => static function ($payload) { |
|
253 | + 'resolve' => static function($payload) { |
|
254 | 254 | $deleted = (object) $payload['deleted']; |
255 | 255 | |
256 | 256 | return ! empty($deleted) ? $deleted : null; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | unset($inputFields['id']); |
266 | 266 | // Register mutation to update an entity. |
267 | 267 | register_graphql_mutation( |
268 | - 'create' . $this->name(), |
|
268 | + 'create'.$this->name(), |
|
269 | 269 | [ |
270 | 270 | 'inputFields' => $inputFields, |
271 | 271 | 'outputFields' => [ |
@@ -25,237 +25,237 @@ |
||
25 | 25 | class Datetime extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * EventDate constructor. |
|
30 | - * |
|
31 | - * @param EEM_Datetime $datetime_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Datetime $datetime_model) |
|
34 | - { |
|
35 | - $this->model = $datetime_model; |
|
36 | - $this->setName('Datetime'); |
|
37 | - $this->setDescription(__('An event date', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
28 | + /** |
|
29 | + * EventDate constructor. |
|
30 | + * |
|
31 | + * @param EEM_Datetime $datetime_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Datetime $datetime_model) |
|
34 | + { |
|
35 | + $this->model = $datetime_model; |
|
36 | + $this->setName('Datetime'); |
|
37 | + $this->setDescription(__('An event date', 'event_espresso')); |
|
38 | + $this->setIsCustomPostType(false); |
|
39 | + parent::__construct(); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @return GraphQLFieldInterface[] |
|
45 | - * @since $VID:$ |
|
46 | - */ |
|
47 | - public function getFields() |
|
48 | - { |
|
49 | - return [ |
|
50 | - new GraphQLField( |
|
51 | - 'id', |
|
52 | - ['non_null' => 'ID'], |
|
53 | - null, |
|
54 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | - ), |
|
56 | - new GraphQLOutputField( |
|
57 | - 'dbId', |
|
58 | - ['non_null' => 'Int'], |
|
59 | - 'ID', |
|
60 | - esc_html__('The datetime ID.', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'name', |
|
64 | - 'String', |
|
65 | - 'name', |
|
66 | - esc_html__('Datetime Name', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'description', |
|
70 | - 'String', |
|
71 | - 'description', |
|
72 | - esc_html__('Description for Datetime', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'startDate', |
|
76 | - 'String', |
|
77 | - 'start_date_and_time', |
|
78 | - esc_html__('Start date and time of the Event', 'event_espresso'), |
|
79 | - [$this, 'formatDatetime'] |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'endDate', |
|
83 | - 'String', |
|
84 | - 'end_date_and_time', |
|
85 | - esc_html__('End date and time of the Event', 'event_espresso'), |
|
86 | - [$this, 'formatDatetime'] |
|
87 | - ), |
|
88 | - new GraphQLField( |
|
89 | - 'capacity', |
|
90 | - 'Int', |
|
91 | - 'reg_limit', |
|
92 | - esc_html__('Registration Limit for this time', 'event_espresso'), |
|
93 | - [$this, 'parseInfiniteValue'] |
|
94 | - ), |
|
95 | - new GraphQLField( |
|
96 | - 'sold', |
|
97 | - 'Int', |
|
98 | - 'sold', |
|
99 | - esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
100 | - ), |
|
101 | - new GraphQLField( |
|
102 | - 'reserved', |
|
103 | - 'Int', |
|
104 | - 'reserved', |
|
105 | - esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
106 | - ), |
|
107 | - new GraphQLField( |
|
108 | - 'order', |
|
109 | - 'Int', |
|
110 | - 'order', |
|
111 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
112 | - ), |
|
113 | - new GraphQLField( |
|
114 | - 'length', |
|
115 | - 'Int', |
|
116 | - 'length', |
|
117 | - esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
118 | - ), |
|
119 | - new GraphQLOutputField( |
|
120 | - 'parent', |
|
121 | - $this->name(), |
|
122 | - null, |
|
123 | - esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
124 | - ), |
|
125 | - new GraphQLInputField( |
|
126 | - 'parent', |
|
127 | - 'ID', |
|
128 | - null, |
|
129 | - esc_html__('The parent datetime ID', 'event_espresso') |
|
130 | - ), |
|
131 | - new GraphQLField( |
|
132 | - 'isPrimary', |
|
133 | - 'Boolean', |
|
134 | - 'is_primary', |
|
135 | - esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
136 | - ), |
|
137 | - new GraphQLField( |
|
138 | - 'isSoldOut', |
|
139 | - 'Boolean', |
|
140 | - 'sold_out', |
|
141 | - esc_html__( |
|
142 | - 'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
143 | - 'event_espresso' |
|
144 | - ) |
|
145 | - ), |
|
146 | - new GraphQLField( |
|
147 | - 'isUpcoming', |
|
148 | - 'Boolean', |
|
149 | - 'is_upcoming', |
|
150 | - esc_html__('Whether the date is upcoming', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLField( |
|
153 | - 'isActive', |
|
154 | - 'Boolean', |
|
155 | - 'is_active', |
|
156 | - esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
157 | - ), |
|
158 | - new GraphQLField( |
|
159 | - 'isExpired', |
|
160 | - 'Boolean', |
|
161 | - 'is_expired', |
|
162 | - esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
163 | - ), |
|
164 | - new GraphQLOutputField( |
|
165 | - 'event', |
|
166 | - 'Event', |
|
167 | - null, |
|
168 | - esc_html__('Event of the datetime.', 'event_espresso') |
|
169 | - ), |
|
170 | - new GraphQLInputField( |
|
171 | - 'eventId', |
|
172 | - 'Int', |
|
173 | - null, |
|
174 | - esc_html__('Event ID of the datetime.', 'event_espresso') |
|
175 | - ), |
|
176 | - new GraphQLInputField( |
|
177 | - 'event', |
|
178 | - 'ID', |
|
179 | - null, |
|
180 | - esc_html__('Globally unique event ID of the datetime.', 'event_espresso') |
|
181 | - ), |
|
182 | - new GraphQLInputField( |
|
183 | - 'tickets', |
|
184 | - ['list_of' => 'ID'], |
|
185 | - null, |
|
186 | - sprintf( |
|
187 | - '%1$s %2$s', |
|
188 | - esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'), |
|
189 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
190 | - ) |
|
191 | - ), |
|
192 | - ]; |
|
193 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
50 | + new GraphQLField( |
|
51 | + 'id', |
|
52 | + ['non_null' => 'ID'], |
|
53 | + null, |
|
54 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | + ), |
|
56 | + new GraphQLOutputField( |
|
57 | + 'dbId', |
|
58 | + ['non_null' => 'Int'], |
|
59 | + 'ID', |
|
60 | + esc_html__('The datetime ID.', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'name', |
|
64 | + 'String', |
|
65 | + 'name', |
|
66 | + esc_html__('Datetime Name', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'description', |
|
70 | + 'String', |
|
71 | + 'description', |
|
72 | + esc_html__('Description for Datetime', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'startDate', |
|
76 | + 'String', |
|
77 | + 'start_date_and_time', |
|
78 | + esc_html__('Start date and time of the Event', 'event_espresso'), |
|
79 | + [$this, 'formatDatetime'] |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'endDate', |
|
83 | + 'String', |
|
84 | + 'end_date_and_time', |
|
85 | + esc_html__('End date and time of the Event', 'event_espresso'), |
|
86 | + [$this, 'formatDatetime'] |
|
87 | + ), |
|
88 | + new GraphQLField( |
|
89 | + 'capacity', |
|
90 | + 'Int', |
|
91 | + 'reg_limit', |
|
92 | + esc_html__('Registration Limit for this time', 'event_espresso'), |
|
93 | + [$this, 'parseInfiniteValue'] |
|
94 | + ), |
|
95 | + new GraphQLField( |
|
96 | + 'sold', |
|
97 | + 'Int', |
|
98 | + 'sold', |
|
99 | + esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
100 | + ), |
|
101 | + new GraphQLField( |
|
102 | + 'reserved', |
|
103 | + 'Int', |
|
104 | + 'reserved', |
|
105 | + esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
106 | + ), |
|
107 | + new GraphQLField( |
|
108 | + 'order', |
|
109 | + 'Int', |
|
110 | + 'order', |
|
111 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
112 | + ), |
|
113 | + new GraphQLField( |
|
114 | + 'length', |
|
115 | + 'Int', |
|
116 | + 'length', |
|
117 | + esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
118 | + ), |
|
119 | + new GraphQLOutputField( |
|
120 | + 'parent', |
|
121 | + $this->name(), |
|
122 | + null, |
|
123 | + esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
124 | + ), |
|
125 | + new GraphQLInputField( |
|
126 | + 'parent', |
|
127 | + 'ID', |
|
128 | + null, |
|
129 | + esc_html__('The parent datetime ID', 'event_espresso') |
|
130 | + ), |
|
131 | + new GraphQLField( |
|
132 | + 'isPrimary', |
|
133 | + 'Boolean', |
|
134 | + 'is_primary', |
|
135 | + esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
136 | + ), |
|
137 | + new GraphQLField( |
|
138 | + 'isSoldOut', |
|
139 | + 'Boolean', |
|
140 | + 'sold_out', |
|
141 | + esc_html__( |
|
142 | + 'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
143 | + 'event_espresso' |
|
144 | + ) |
|
145 | + ), |
|
146 | + new GraphQLField( |
|
147 | + 'isUpcoming', |
|
148 | + 'Boolean', |
|
149 | + 'is_upcoming', |
|
150 | + esc_html__('Whether the date is upcoming', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLField( |
|
153 | + 'isActive', |
|
154 | + 'Boolean', |
|
155 | + 'is_active', |
|
156 | + esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
157 | + ), |
|
158 | + new GraphQLField( |
|
159 | + 'isExpired', |
|
160 | + 'Boolean', |
|
161 | + 'is_expired', |
|
162 | + esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
163 | + ), |
|
164 | + new GraphQLOutputField( |
|
165 | + 'event', |
|
166 | + 'Event', |
|
167 | + null, |
|
168 | + esc_html__('Event of the datetime.', 'event_espresso') |
|
169 | + ), |
|
170 | + new GraphQLInputField( |
|
171 | + 'eventId', |
|
172 | + 'Int', |
|
173 | + null, |
|
174 | + esc_html__('Event ID of the datetime.', 'event_espresso') |
|
175 | + ), |
|
176 | + new GraphQLInputField( |
|
177 | + 'event', |
|
178 | + 'ID', |
|
179 | + null, |
|
180 | + esc_html__('Globally unique event ID of the datetime.', 'event_espresso') |
|
181 | + ), |
|
182 | + new GraphQLInputField( |
|
183 | + 'tickets', |
|
184 | + ['list_of' => 'ID'], |
|
185 | + null, |
|
186 | + sprintf( |
|
187 | + '%1$s %2$s', |
|
188 | + esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'), |
|
189 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
190 | + ) |
|
191 | + ), |
|
192 | + ]; |
|
193 | + } |
|
194 | 194 | |
195 | 195 | |
196 | - /** |
|
197 | - * @param array $inputFields The mutation input fields. |
|
198 | - * @throws InvalidArgumentException |
|
199 | - * @throws ReflectionException |
|
200 | - * @since $VID:$ |
|
201 | - */ |
|
202 | - public function registerMutations(array $inputFields) |
|
203 | - { |
|
204 | - // Register mutation to update an entity. |
|
205 | - register_graphql_mutation( |
|
206 | - 'update' . $this->name(), |
|
207 | - [ |
|
208 | - 'inputFields' => $inputFields, |
|
209 | - 'outputFields' => [ |
|
210 | - lcfirst($this->name()) => [ |
|
211 | - 'type' => $this->name(), |
|
212 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
213 | - ], |
|
214 | - ], |
|
215 | - 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
|
216 | - ] |
|
217 | - ); |
|
218 | - // Register mutation to delete an entity. |
|
219 | - register_graphql_mutation( |
|
220 | - 'delete' . $this->name(), |
|
221 | - [ |
|
222 | - 'inputFields' => [ |
|
223 | - 'id' => $inputFields['id'], |
|
224 | - 'deletePermanently' => [ |
|
225 | - 'type' => 'Boolean', |
|
226 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
227 | - ], |
|
228 | - ], |
|
229 | - 'outputFields' => [ |
|
230 | - lcfirst($this->name()) => [ |
|
231 | - 'type' => $this->name(), |
|
232 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
233 | - 'resolve' => static function ($payload) { |
|
234 | - $deleted = (object) $payload['deleted']; |
|
196 | + /** |
|
197 | + * @param array $inputFields The mutation input fields. |
|
198 | + * @throws InvalidArgumentException |
|
199 | + * @throws ReflectionException |
|
200 | + * @since $VID:$ |
|
201 | + */ |
|
202 | + public function registerMutations(array $inputFields) |
|
203 | + { |
|
204 | + // Register mutation to update an entity. |
|
205 | + register_graphql_mutation( |
|
206 | + 'update' . $this->name(), |
|
207 | + [ |
|
208 | + 'inputFields' => $inputFields, |
|
209 | + 'outputFields' => [ |
|
210 | + lcfirst($this->name()) => [ |
|
211 | + 'type' => $this->name(), |
|
212 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
213 | + ], |
|
214 | + ], |
|
215 | + 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
|
216 | + ] |
|
217 | + ); |
|
218 | + // Register mutation to delete an entity. |
|
219 | + register_graphql_mutation( |
|
220 | + 'delete' . $this->name(), |
|
221 | + [ |
|
222 | + 'inputFields' => [ |
|
223 | + 'id' => $inputFields['id'], |
|
224 | + 'deletePermanently' => [ |
|
225 | + 'type' => 'Boolean', |
|
226 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
227 | + ], |
|
228 | + ], |
|
229 | + 'outputFields' => [ |
|
230 | + lcfirst($this->name()) => [ |
|
231 | + 'type' => $this->name(), |
|
232 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
233 | + 'resolve' => static function ($payload) { |
|
234 | + $deleted = (object) $payload['deleted']; |
|
235 | 235 | |
236 | - return ! empty($deleted) ? $deleted : null; |
|
237 | - }, |
|
238 | - ], |
|
239 | - ], |
|
240 | - 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
|
241 | - ] |
|
242 | - ); |
|
236 | + return ! empty($deleted) ? $deleted : null; |
|
237 | + }, |
|
238 | + ], |
|
239 | + ], |
|
240 | + 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
|
241 | + ] |
|
242 | + ); |
|
243 | 243 | |
244 | - // remove primary key from input. |
|
245 | - unset($inputFields['id']); |
|
246 | - // Register mutation to update an entity. |
|
247 | - register_graphql_mutation( |
|
248 | - 'create' . $this->name(), |
|
249 | - [ |
|
250 | - 'inputFields' => $inputFields, |
|
251 | - 'outputFields' => [ |
|
252 | - lcfirst($this->name()) => [ |
|
253 | - 'type' => $this->name(), |
|
254 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
255 | - ], |
|
256 | - ], |
|
257 | - 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
|
258 | - ] |
|
259 | - ); |
|
260 | - } |
|
244 | + // remove primary key from input. |
|
245 | + unset($inputFields['id']); |
|
246 | + // Register mutation to update an entity. |
|
247 | + register_graphql_mutation( |
|
248 | + 'create' . $this->name(), |
|
249 | + [ |
|
250 | + 'inputFields' => $inputFields, |
|
251 | + 'outputFields' => [ |
|
252 | + lcfirst($this->name()) => [ |
|
253 | + 'type' => $this->name(), |
|
254 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
255 | + ], |
|
256 | + ], |
|
257 | + 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
|
258 | + ] |
|
259 | + ); |
|
260 | + } |
|
261 | 261 | } |
@@ -20,71 +20,71 @@ |
||
20 | 20 | class State extends TypeBase |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * State constructor. |
|
25 | - * |
|
26 | - * @param EEM_State $state_model |
|
27 | - */ |
|
28 | - public function __construct(EEM_State $state_model) |
|
29 | - { |
|
30 | - $this->model = $state_model; |
|
31 | - $this->setName('State'); |
|
32 | - $this->setDescription(__('A state', 'event_espresso')); |
|
33 | - $this->setIsCustomPostType(false); |
|
23 | + /** |
|
24 | + * State constructor. |
|
25 | + * |
|
26 | + * @param EEM_State $state_model |
|
27 | + */ |
|
28 | + public function __construct(EEM_State $state_model) |
|
29 | + { |
|
30 | + $this->model = $state_model; |
|
31 | + $this->setName('State'); |
|
32 | + $this->setDescription(__('A state', 'event_espresso')); |
|
33 | + $this->setIsCustomPostType(false); |
|
34 | 34 | |
35 | - parent::__construct(); |
|
36 | - } |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @return GraphQLFieldInterface[] |
|
41 | - * @since $VID:$ |
|
42 | - */ |
|
43 | - public function getFields() |
|
44 | - { |
|
45 | - return [ |
|
46 | - new GraphQLField( |
|
47 | - 'id', |
|
48 | - ['non_null' => 'ID'], |
|
49 | - null, |
|
50 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
51 | - ), |
|
52 | - new GraphQLOutputField( |
|
53 | - 'dbId', |
|
54 | - ['non_null' => 'Int'], |
|
55 | - 'ID', |
|
56 | - esc_html__('State ID', 'event_espresso') |
|
57 | - ), |
|
58 | - new GraphQLField( |
|
59 | - 'abbreviation', |
|
60 | - 'String', |
|
61 | - 'abbrev', |
|
62 | - esc_html__('State Abbreviation', 'event_espresso') |
|
63 | - ), |
|
64 | - new GraphQLField( |
|
65 | - 'name', |
|
66 | - 'String', |
|
67 | - 'name', |
|
68 | - esc_html__('State Name', 'event_espresso') |
|
69 | - ), |
|
70 | - new GraphQLField( |
|
71 | - 'isActive', |
|
72 | - 'Boolean', |
|
73 | - 'active', |
|
74 | - esc_html__('State Active Flag', 'event_espresso') |
|
75 | - ), |
|
76 | - new GraphQLOutputField( |
|
77 | - 'country', |
|
78 | - 'Country', |
|
79 | - null, |
|
80 | - esc_html__('Country for the state', 'event_espresso') |
|
81 | - ), |
|
82 | - new GraphQLInputField( |
|
83 | - 'country', |
|
84 | - 'String', |
|
85 | - null, |
|
86 | - esc_html__('Country ISO Code', 'event_espresso') |
|
87 | - ), |
|
88 | - ]; |
|
89 | - } |
|
39 | + /** |
|
40 | + * @return GraphQLFieldInterface[] |
|
41 | + * @since $VID:$ |
|
42 | + */ |
|
43 | + public function getFields() |
|
44 | + { |
|
45 | + return [ |
|
46 | + new GraphQLField( |
|
47 | + 'id', |
|
48 | + ['non_null' => 'ID'], |
|
49 | + null, |
|
50 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
51 | + ), |
|
52 | + new GraphQLOutputField( |
|
53 | + 'dbId', |
|
54 | + ['non_null' => 'Int'], |
|
55 | + 'ID', |
|
56 | + esc_html__('State ID', 'event_espresso') |
|
57 | + ), |
|
58 | + new GraphQLField( |
|
59 | + 'abbreviation', |
|
60 | + 'String', |
|
61 | + 'abbrev', |
|
62 | + esc_html__('State Abbreviation', 'event_espresso') |
|
63 | + ), |
|
64 | + new GraphQLField( |
|
65 | + 'name', |
|
66 | + 'String', |
|
67 | + 'name', |
|
68 | + esc_html__('State Name', 'event_espresso') |
|
69 | + ), |
|
70 | + new GraphQLField( |
|
71 | + 'isActive', |
|
72 | + 'Boolean', |
|
73 | + 'active', |
|
74 | + esc_html__('State Active Flag', 'event_espresso') |
|
75 | + ), |
|
76 | + new GraphQLOutputField( |
|
77 | + 'country', |
|
78 | + 'Country', |
|
79 | + null, |
|
80 | + esc_html__('Country for the state', 'event_espresso') |
|
81 | + ), |
|
82 | + new GraphQLInputField( |
|
83 | + 'country', |
|
84 | + 'String', |
|
85 | + null, |
|
86 | + esc_html__('Country ISO Code', 'event_espresso') |
|
87 | + ), |
|
88 | + ]; |
|
89 | + } |
|
90 | 90 | } |
@@ -21,188 +21,188 @@ |
||
21 | 21 | class Venue extends TypeBase |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Venue constructor. |
|
26 | - * |
|
27 | - * @param EEM_Venue $venue_model |
|
28 | - */ |
|
29 | - public function __construct(EEM_Venue $venue_model) |
|
30 | - { |
|
31 | - $this->model = $venue_model; |
|
32 | - $this->setName('Venue'); |
|
33 | - $this->setIsCustomPostType(true); |
|
34 | - parent::__construct(); |
|
35 | - } |
|
24 | + /** |
|
25 | + * Venue constructor. |
|
26 | + * |
|
27 | + * @param EEM_Venue $venue_model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Venue $venue_model) |
|
30 | + { |
|
31 | + $this->model = $venue_model; |
|
32 | + $this->setName('Venue'); |
|
33 | + $this->setIsCustomPostType(true); |
|
34 | + parent::__construct(); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @return GraphQLFieldInterface[] |
|
40 | - * @since $VID:$ |
|
41 | - */ |
|
42 | - public function getFields() |
|
43 | - { |
|
44 | - return [ |
|
45 | - new GraphQLOutputField( |
|
46 | - 'dbId', |
|
47 | - ['non_null' => 'Int'], |
|
48 | - 'ID', |
|
49 | - esc_html__('The venue ID.', 'event_espresso') |
|
50 | - ), |
|
51 | - new GraphQLField( |
|
52 | - 'name', |
|
53 | - 'String', |
|
54 | - 'name', |
|
55 | - esc_html__('Venue Name', 'event_espresso') |
|
56 | - ), |
|
57 | - new GraphQLField( |
|
58 | - 'desc', |
|
59 | - 'String', |
|
60 | - 'description', |
|
61 | - esc_html__('Venue Description', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'shortDesc', |
|
65 | - 'String', |
|
66 | - 'excerpt', |
|
67 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLField( |
|
70 | - 'identifier', |
|
71 | - 'String', |
|
72 | - 'identifier', |
|
73 | - esc_html__('Venue Identifier', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLField( |
|
76 | - 'created', |
|
77 | - 'String', |
|
78 | - 'created', |
|
79 | - esc_html__('Date Venue Created', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'order', |
|
83 | - 'Int', |
|
84 | - 'order', |
|
85 | - esc_html__('Venue order', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLOutputField( |
|
88 | - 'wpUser', |
|
89 | - 'User', |
|
90 | - null, |
|
91 | - esc_html__('Venue Creator', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLInputField( |
|
94 | - 'wpUser', |
|
95 | - 'Int', |
|
96 | - null, |
|
97 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLField( |
|
100 | - 'address', |
|
101 | - 'String', |
|
102 | - 'address', |
|
103 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'address2', |
|
107 | - 'String', |
|
108 | - 'address2', |
|
109 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'city', |
|
113 | - 'String', |
|
114 | - 'city', |
|
115 | - esc_html__('Venue City', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLOutputField( |
|
118 | - 'state', |
|
119 | - 'State', |
|
120 | - null, |
|
121 | - esc_html__('Venue state', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLInputField( |
|
124 | - 'state', |
|
125 | - 'Int', |
|
126 | - null, |
|
127 | - esc_html__('State ID', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLOutputField( |
|
130 | - 'country', |
|
131 | - 'Country', |
|
132 | - null, |
|
133 | - esc_html__('Venue country', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLInputField( |
|
136 | - 'country', |
|
137 | - 'String', |
|
138 | - null, |
|
139 | - esc_html__('Country ISO Code', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLField( |
|
142 | - 'zip', |
|
143 | - 'String', |
|
144 | - 'zip', |
|
145 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'capacity', |
|
149 | - 'Int', |
|
150 | - 'capacity', |
|
151 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
152 | - [$this, 'parseInfiniteValue'] |
|
153 | - ), |
|
154 | - new GraphQLField( |
|
155 | - 'phone', |
|
156 | - 'String', |
|
157 | - 'phone', |
|
158 | - esc_html__('Venue Phone', 'event_espresso') |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'virtualPhone', |
|
162 | - 'String', |
|
163 | - 'virtual_phone', |
|
164 | - esc_html__('Call in Number', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'url', |
|
168 | - 'String', |
|
169 | - 'venue_url', |
|
170 | - esc_html__('Venue Website', 'event_espresso') |
|
171 | - ), |
|
172 | - new GraphQLField( |
|
173 | - 'virtualUrl', |
|
174 | - 'String', |
|
175 | - 'virtual_url', |
|
176 | - esc_html__('Virtual URL', 'event_espresso') |
|
177 | - ), |
|
178 | - new GraphQLField( |
|
179 | - 'googleMapLink', |
|
180 | - 'String', |
|
181 | - 'google_map_link', |
|
182 | - esc_html__('Google Map Link', 'event_espresso') |
|
183 | - ), |
|
184 | - new GraphQLField( |
|
185 | - 'enableForGmap', |
|
186 | - 'String', |
|
187 | - 'enable_for_gmap', |
|
188 | - esc_html__('Show Google Map?', 'event_espresso') |
|
189 | - ), |
|
190 | - ]; |
|
191 | - } |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + public function getFields() |
|
43 | + { |
|
44 | + return [ |
|
45 | + new GraphQLOutputField( |
|
46 | + 'dbId', |
|
47 | + ['non_null' => 'Int'], |
|
48 | + 'ID', |
|
49 | + esc_html__('The venue ID.', 'event_espresso') |
|
50 | + ), |
|
51 | + new GraphQLField( |
|
52 | + 'name', |
|
53 | + 'String', |
|
54 | + 'name', |
|
55 | + esc_html__('Venue Name', 'event_espresso') |
|
56 | + ), |
|
57 | + new GraphQLField( |
|
58 | + 'desc', |
|
59 | + 'String', |
|
60 | + 'description', |
|
61 | + esc_html__('Venue Description', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'shortDesc', |
|
65 | + 'String', |
|
66 | + 'excerpt', |
|
67 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLField( |
|
70 | + 'identifier', |
|
71 | + 'String', |
|
72 | + 'identifier', |
|
73 | + esc_html__('Venue Identifier', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLField( |
|
76 | + 'created', |
|
77 | + 'String', |
|
78 | + 'created', |
|
79 | + esc_html__('Date Venue Created', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'order', |
|
83 | + 'Int', |
|
84 | + 'order', |
|
85 | + esc_html__('Venue order', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLOutputField( |
|
88 | + 'wpUser', |
|
89 | + 'User', |
|
90 | + null, |
|
91 | + esc_html__('Venue Creator', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLInputField( |
|
94 | + 'wpUser', |
|
95 | + 'Int', |
|
96 | + null, |
|
97 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLField( |
|
100 | + 'address', |
|
101 | + 'String', |
|
102 | + 'address', |
|
103 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'address2', |
|
107 | + 'String', |
|
108 | + 'address2', |
|
109 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'city', |
|
113 | + 'String', |
|
114 | + 'city', |
|
115 | + esc_html__('Venue City', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLOutputField( |
|
118 | + 'state', |
|
119 | + 'State', |
|
120 | + null, |
|
121 | + esc_html__('Venue state', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLInputField( |
|
124 | + 'state', |
|
125 | + 'Int', |
|
126 | + null, |
|
127 | + esc_html__('State ID', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLOutputField( |
|
130 | + 'country', |
|
131 | + 'Country', |
|
132 | + null, |
|
133 | + esc_html__('Venue country', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLInputField( |
|
136 | + 'country', |
|
137 | + 'String', |
|
138 | + null, |
|
139 | + esc_html__('Country ISO Code', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLField( |
|
142 | + 'zip', |
|
143 | + 'String', |
|
144 | + 'zip', |
|
145 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'capacity', |
|
149 | + 'Int', |
|
150 | + 'capacity', |
|
151 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
152 | + [$this, 'parseInfiniteValue'] |
|
153 | + ), |
|
154 | + new GraphQLField( |
|
155 | + 'phone', |
|
156 | + 'String', |
|
157 | + 'phone', |
|
158 | + esc_html__('Venue Phone', 'event_espresso') |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'virtualPhone', |
|
162 | + 'String', |
|
163 | + 'virtual_phone', |
|
164 | + esc_html__('Call in Number', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'url', |
|
168 | + 'String', |
|
169 | + 'venue_url', |
|
170 | + esc_html__('Venue Website', 'event_espresso') |
|
171 | + ), |
|
172 | + new GraphQLField( |
|
173 | + 'virtualUrl', |
|
174 | + 'String', |
|
175 | + 'virtual_url', |
|
176 | + esc_html__('Virtual URL', 'event_espresso') |
|
177 | + ), |
|
178 | + new GraphQLField( |
|
179 | + 'googleMapLink', |
|
180 | + 'String', |
|
181 | + 'google_map_link', |
|
182 | + esc_html__('Google Map Link', 'event_espresso') |
|
183 | + ), |
|
184 | + new GraphQLField( |
|
185 | + 'enableForGmap', |
|
186 | + 'String', |
|
187 | + 'enable_for_gmap', |
|
188 | + esc_html__('Show Google Map?', 'event_espresso') |
|
189 | + ), |
|
190 | + ]; |
|
191 | + } |
|
192 | 192 | |
193 | 193 | |
194 | - /** |
|
195 | - * Extends the existing WP GraphQL mutations. |
|
196 | - * |
|
197 | - * @since $VID:$ |
|
198 | - */ |
|
199 | - public function extendMutations() |
|
200 | - { |
|
201 | - add_action( |
|
202 | - 'graphql_post_object_mutation_update_additional_data', |
|
203 | - VenueUpdate::mutateFields($this->model, $this), |
|
204 | - 10, |
|
205 | - 6 |
|
206 | - ); |
|
207 | - } |
|
194 | + /** |
|
195 | + * Extends the existing WP GraphQL mutations. |
|
196 | + * |
|
197 | + * @since $VID:$ |
|
198 | + */ |
|
199 | + public function extendMutations() |
|
200 | + { |
|
201 | + add_action( |
|
202 | + 'graphql_post_object_mutation_update_additional_data', |
|
203 | + VenueUpdate::mutateFields($this->model, $this), |
|
204 | + 10, |
|
205 | + 6 |
|
206 | + ); |
|
207 | + } |
|
208 | 208 | } |
@@ -21,196 +21,196 @@ |
||
21 | 21 | class Event extends TypeBase |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Event constructor. |
|
26 | - * |
|
27 | - * @param EEM_Event $event_model |
|
28 | - */ |
|
29 | - public function __construct(EEM_Event $event_model) |
|
30 | - { |
|
31 | - $this->model = $event_model; |
|
32 | - $this->setName('Event'); |
|
33 | - $this->setIsCustomPostType(true); |
|
34 | - parent::__construct(); |
|
35 | - } |
|
24 | + /** |
|
25 | + * Event constructor. |
|
26 | + * |
|
27 | + * @param EEM_Event $event_model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Event $event_model) |
|
30 | + { |
|
31 | + $this->model = $event_model; |
|
32 | + $this->setName('Event'); |
|
33 | + $this->setIsCustomPostType(true); |
|
34 | + parent::__construct(); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @return GraphQLFieldInterface[] |
|
40 | - * @since $VID:$ |
|
41 | - */ |
|
42 | - public function getFields() |
|
43 | - { |
|
44 | - return [ |
|
45 | - new GraphQLOutputField( |
|
46 | - 'dbId', |
|
47 | - ['non_null' => 'Int'], |
|
48 | - 'ID', |
|
49 | - esc_html__('The event ID.', 'event_espresso') |
|
50 | - ), |
|
51 | - new GraphQLField( |
|
52 | - 'name', |
|
53 | - 'String', |
|
54 | - 'name', |
|
55 | - esc_html__('Event Name', 'event_espresso') |
|
56 | - ), |
|
57 | - new GraphQLField( |
|
58 | - 'desc', |
|
59 | - 'String', |
|
60 | - 'description', |
|
61 | - esc_html__('Event Description', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'shortDesc', |
|
65 | - 'String', |
|
66 | - 'short_description', |
|
67 | - esc_html__('Event Short Description', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLField( |
|
70 | - 'created', |
|
71 | - 'String', |
|
72 | - 'created', |
|
73 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLOutputField( |
|
76 | - 'wpUser', |
|
77 | - 'User', |
|
78 | - null, |
|
79 | - esc_html__('Event Creator', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLInputField( |
|
82 | - 'wpUser', |
|
83 | - 'Int', |
|
84 | - null, |
|
85 | - esc_html__('Event Creator ID', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLField( |
|
88 | - 'order', |
|
89 | - 'Int', |
|
90 | - 'order', |
|
91 | - esc_html__('Event Menu Order', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLField( |
|
94 | - 'displayDesc', |
|
95 | - 'Boolean', |
|
96 | - 'display_description', |
|
97 | - esc_html__('Display Description Flag', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLField( |
|
100 | - 'displayTicketSelector', |
|
101 | - 'Boolean', |
|
102 | - 'display_ticket_selector', |
|
103 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'visibleOn', |
|
107 | - 'String', |
|
108 | - 'visible_on', |
|
109 | - esc_html__('Event Visible Date', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'additionalLimit', |
|
113 | - 'String', |
|
114 | - 'additional_limit', |
|
115 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLField( |
|
118 | - 'phone', |
|
119 | - 'String', |
|
120 | - 'phone', |
|
121 | - esc_html__('Event Phone Number', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'memberOnly', |
|
125 | - 'Boolean', |
|
126 | - 'member_only', |
|
127 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLField( |
|
130 | - 'allowOverflow', |
|
131 | - 'Boolean', |
|
132 | - 'allow_overflow', |
|
133 | - esc_html__('Allow Overflow on Event', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLField( |
|
136 | - 'timezoneString', |
|
137 | - 'String', |
|
138 | - 'timezone_string', |
|
139 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLField( |
|
142 | - 'externalUrl', |
|
143 | - 'String', |
|
144 | - 'external_url', |
|
145 | - esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'donations', |
|
149 | - 'Boolean', |
|
150 | - 'donations', |
|
151 | - esc_html__('Accept Donations?', 'event_espresso') |
|
152 | - ), |
|
153 | - new GraphQLField( |
|
154 | - 'isSoldOut', |
|
155 | - 'Boolean', |
|
156 | - 'is_sold_out', |
|
157 | - esc_html__( |
|
158 | - 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
159 | - 'event_espresso' |
|
160 | - ) |
|
161 | - ), |
|
162 | - new GraphQLField( |
|
163 | - 'isPostponed', |
|
164 | - 'Boolean', |
|
165 | - 'is_postponed', |
|
166 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
167 | - ), |
|
168 | - new GraphQLField( |
|
169 | - 'isCancelled', |
|
170 | - 'Boolean', |
|
171 | - 'is_cancelled', |
|
172 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
173 | - ), |
|
174 | - new GraphQLField( |
|
175 | - 'isUpcoming', |
|
176 | - 'Boolean', |
|
177 | - 'is_upcoming', |
|
178 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
179 | - ), |
|
180 | - new GraphQLField( |
|
181 | - 'isActive', |
|
182 | - 'Boolean', |
|
183 | - 'is_active', |
|
184 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
185 | - ), |
|
186 | - new GraphQLField( |
|
187 | - 'isInactive', |
|
188 | - 'Boolean', |
|
189 | - 'is_inactive', |
|
190 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
191 | - ), |
|
192 | - new GraphQLField( |
|
193 | - 'isExpired', |
|
194 | - 'Boolean', |
|
195 | - 'is_expired', |
|
196 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
197 | - ), |
|
198 | - ]; |
|
199 | - } |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + public function getFields() |
|
43 | + { |
|
44 | + return [ |
|
45 | + new GraphQLOutputField( |
|
46 | + 'dbId', |
|
47 | + ['non_null' => 'Int'], |
|
48 | + 'ID', |
|
49 | + esc_html__('The event ID.', 'event_espresso') |
|
50 | + ), |
|
51 | + new GraphQLField( |
|
52 | + 'name', |
|
53 | + 'String', |
|
54 | + 'name', |
|
55 | + esc_html__('Event Name', 'event_espresso') |
|
56 | + ), |
|
57 | + new GraphQLField( |
|
58 | + 'desc', |
|
59 | + 'String', |
|
60 | + 'description', |
|
61 | + esc_html__('Event Description', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'shortDesc', |
|
65 | + 'String', |
|
66 | + 'short_description', |
|
67 | + esc_html__('Event Short Description', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLField( |
|
70 | + 'created', |
|
71 | + 'String', |
|
72 | + 'created', |
|
73 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLOutputField( |
|
76 | + 'wpUser', |
|
77 | + 'User', |
|
78 | + null, |
|
79 | + esc_html__('Event Creator', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLInputField( |
|
82 | + 'wpUser', |
|
83 | + 'Int', |
|
84 | + null, |
|
85 | + esc_html__('Event Creator ID', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLField( |
|
88 | + 'order', |
|
89 | + 'Int', |
|
90 | + 'order', |
|
91 | + esc_html__('Event Menu Order', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLField( |
|
94 | + 'displayDesc', |
|
95 | + 'Boolean', |
|
96 | + 'display_description', |
|
97 | + esc_html__('Display Description Flag', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLField( |
|
100 | + 'displayTicketSelector', |
|
101 | + 'Boolean', |
|
102 | + 'display_ticket_selector', |
|
103 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'visibleOn', |
|
107 | + 'String', |
|
108 | + 'visible_on', |
|
109 | + esc_html__('Event Visible Date', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'additionalLimit', |
|
113 | + 'String', |
|
114 | + 'additional_limit', |
|
115 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLField( |
|
118 | + 'phone', |
|
119 | + 'String', |
|
120 | + 'phone', |
|
121 | + esc_html__('Event Phone Number', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'memberOnly', |
|
125 | + 'Boolean', |
|
126 | + 'member_only', |
|
127 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLField( |
|
130 | + 'allowOverflow', |
|
131 | + 'Boolean', |
|
132 | + 'allow_overflow', |
|
133 | + esc_html__('Allow Overflow on Event', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLField( |
|
136 | + 'timezoneString', |
|
137 | + 'String', |
|
138 | + 'timezone_string', |
|
139 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLField( |
|
142 | + 'externalUrl', |
|
143 | + 'String', |
|
144 | + 'external_url', |
|
145 | + esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'donations', |
|
149 | + 'Boolean', |
|
150 | + 'donations', |
|
151 | + esc_html__('Accept Donations?', 'event_espresso') |
|
152 | + ), |
|
153 | + new GraphQLField( |
|
154 | + 'isSoldOut', |
|
155 | + 'Boolean', |
|
156 | + 'is_sold_out', |
|
157 | + esc_html__( |
|
158 | + 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
159 | + 'event_espresso' |
|
160 | + ) |
|
161 | + ), |
|
162 | + new GraphQLField( |
|
163 | + 'isPostponed', |
|
164 | + 'Boolean', |
|
165 | + 'is_postponed', |
|
166 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
167 | + ), |
|
168 | + new GraphQLField( |
|
169 | + 'isCancelled', |
|
170 | + 'Boolean', |
|
171 | + 'is_cancelled', |
|
172 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
173 | + ), |
|
174 | + new GraphQLField( |
|
175 | + 'isUpcoming', |
|
176 | + 'Boolean', |
|
177 | + 'is_upcoming', |
|
178 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
179 | + ), |
|
180 | + new GraphQLField( |
|
181 | + 'isActive', |
|
182 | + 'Boolean', |
|
183 | + 'is_active', |
|
184 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
185 | + ), |
|
186 | + new GraphQLField( |
|
187 | + 'isInactive', |
|
188 | + 'Boolean', |
|
189 | + 'is_inactive', |
|
190 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
191 | + ), |
|
192 | + new GraphQLField( |
|
193 | + 'isExpired', |
|
194 | + 'Boolean', |
|
195 | + 'is_expired', |
|
196 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
197 | + ), |
|
198 | + ]; |
|
199 | + } |
|
200 | 200 | |
201 | 201 | |
202 | - /** |
|
203 | - * Extends the existing WP GraphQL mutations. |
|
204 | - * |
|
205 | - * @since $VID:$ |
|
206 | - */ |
|
207 | - public function extendMutations() |
|
208 | - { |
|
209 | - add_action( |
|
210 | - 'graphql_post_object_mutation_update_additional_data', |
|
211 | - EventUpdate::mutateFields($this->model, $this), |
|
212 | - 10, |
|
213 | - 6 |
|
214 | - ); |
|
215 | - } |
|
202 | + /** |
|
203 | + * Extends the existing WP GraphQL mutations. |
|
204 | + * |
|
205 | + * @since $VID:$ |
|
206 | + */ |
|
207 | + public function extendMutations() |
|
208 | + { |
|
209 | + add_action( |
|
210 | + 'graphql_post_object_mutation_update_additional_data', |
|
211 | + EventUpdate::mutateFields($this->model, $this), |
|
212 | + 10, |
|
213 | + 6 |
|
214 | + ); |
|
215 | + } |
|
216 | 216 | } |
@@ -25,203 +25,203 @@ |
||
25 | 25 | class Price extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Price constructor. |
|
30 | - * |
|
31 | - * @param EEM_Price $price_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Price $price_model) |
|
34 | - { |
|
35 | - $this->model = $price_model; |
|
36 | - $this->setName('Price'); |
|
37 | - $this->setDescription(__('A price.', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
28 | + /** |
|
29 | + * Price constructor. |
|
30 | + * |
|
31 | + * @param EEM_Price $price_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Price $price_model) |
|
34 | + { |
|
35 | + $this->model = $price_model; |
|
36 | + $this->setName('Price'); |
|
37 | + $this->setDescription(__('A price.', 'event_espresso')); |
|
38 | + $this->setIsCustomPostType(false); |
|
39 | + parent::__construct(); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @return GraphQLFieldInterface[] |
|
45 | - * @since $VID:$ |
|
46 | - */ |
|
47 | - public function getFields() |
|
48 | - { |
|
49 | - return [ |
|
50 | - new GraphQLField( |
|
51 | - 'id', |
|
52 | - ['non_null' => 'ID'], |
|
53 | - null, |
|
54 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | - ), |
|
56 | - new GraphQLOutputField( |
|
57 | - 'dbId', |
|
58 | - ['non_null' => 'Int'], |
|
59 | - 'ID', |
|
60 | - esc_html__('Price ID', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'name', |
|
64 | - 'String', |
|
65 | - 'name', |
|
66 | - esc_html__('Price Name', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'amount', |
|
70 | - 'Float', |
|
71 | - 'amount', |
|
72 | - esc_html__('Price Amount', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'desc', |
|
76 | - 'String', |
|
77 | - 'desc', |
|
78 | - esc_html__('Price description', 'event_espresso') |
|
79 | - ), |
|
80 | - new GraphQLField( |
|
81 | - 'overrides', |
|
82 | - 'Int', |
|
83 | - 'overrides', |
|
84 | - esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
85 | - ), |
|
86 | - new GraphQLField( |
|
87 | - 'order', |
|
88 | - 'Int', |
|
89 | - 'order', |
|
90 | - esc_html__('Order of Application of Price.', 'event_espresso') |
|
91 | - ), |
|
92 | - new GraphQLOutputField( |
|
93 | - 'parent', |
|
94 | - $this->name(), |
|
95 | - null, |
|
96 | - esc_html__('The parent price of the current price', 'event_espresso') |
|
97 | - ), |
|
98 | - new GraphQLInputField( |
|
99 | - 'parent', |
|
100 | - 'ID', |
|
101 | - null, |
|
102 | - esc_html__('The parent price ID', 'event_espresso') |
|
103 | - ), |
|
104 | - new GraphQLOutputField( |
|
105 | - 'priceType', |
|
106 | - 'PriceType', |
|
107 | - 'type_obj', |
|
108 | - esc_html__('The related price type object.', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLInputField( |
|
111 | - 'priceType', |
|
112 | - 'ID', |
|
113 | - null, |
|
114 | - esc_html__('The price type ID', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLOutputField( |
|
117 | - 'isDeleted', |
|
118 | - 'Boolean', |
|
119 | - 'deleted', |
|
120 | - esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
121 | - ), |
|
122 | - new GraphQLField( |
|
123 | - 'isDefault', |
|
124 | - 'Boolean', |
|
125 | - 'is_default', |
|
126 | - esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
127 | - ), |
|
128 | - new GraphQLOutputField( |
|
129 | - 'isPercent', |
|
130 | - 'Boolean', |
|
131 | - 'is_percent', |
|
132 | - esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
133 | - ), |
|
134 | - new GraphQLOutputField( |
|
135 | - 'isBasePrice', |
|
136 | - 'Boolean', |
|
137 | - 'is_base_price', |
|
138 | - esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
139 | - ), |
|
140 | - new GraphQLOutputField( |
|
141 | - 'isDiscount', |
|
142 | - 'Boolean', |
|
143 | - 'is_discount', |
|
144 | - esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
145 | - ), |
|
146 | - new GraphQLOutputField( |
|
147 | - 'wpUser', |
|
148 | - 'User', |
|
149 | - null, |
|
150 | - esc_html__('Price Creator', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLInputField( |
|
153 | - 'wpUser', |
|
154 | - 'Int', |
|
155 | - null, |
|
156 | - esc_html__('Price Creator ID', 'event_espresso') |
|
157 | - ), |
|
158 | - ]; |
|
159 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
50 | + new GraphQLField( |
|
51 | + 'id', |
|
52 | + ['non_null' => 'ID'], |
|
53 | + null, |
|
54 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | + ), |
|
56 | + new GraphQLOutputField( |
|
57 | + 'dbId', |
|
58 | + ['non_null' => 'Int'], |
|
59 | + 'ID', |
|
60 | + esc_html__('Price ID', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'name', |
|
64 | + 'String', |
|
65 | + 'name', |
|
66 | + esc_html__('Price Name', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'amount', |
|
70 | + 'Float', |
|
71 | + 'amount', |
|
72 | + esc_html__('Price Amount', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'desc', |
|
76 | + 'String', |
|
77 | + 'desc', |
|
78 | + esc_html__('Price description', 'event_espresso') |
|
79 | + ), |
|
80 | + new GraphQLField( |
|
81 | + 'overrides', |
|
82 | + 'Int', |
|
83 | + 'overrides', |
|
84 | + esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
85 | + ), |
|
86 | + new GraphQLField( |
|
87 | + 'order', |
|
88 | + 'Int', |
|
89 | + 'order', |
|
90 | + esc_html__('Order of Application of Price.', 'event_espresso') |
|
91 | + ), |
|
92 | + new GraphQLOutputField( |
|
93 | + 'parent', |
|
94 | + $this->name(), |
|
95 | + null, |
|
96 | + esc_html__('The parent price of the current price', 'event_espresso') |
|
97 | + ), |
|
98 | + new GraphQLInputField( |
|
99 | + 'parent', |
|
100 | + 'ID', |
|
101 | + null, |
|
102 | + esc_html__('The parent price ID', 'event_espresso') |
|
103 | + ), |
|
104 | + new GraphQLOutputField( |
|
105 | + 'priceType', |
|
106 | + 'PriceType', |
|
107 | + 'type_obj', |
|
108 | + esc_html__('The related price type object.', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLInputField( |
|
111 | + 'priceType', |
|
112 | + 'ID', |
|
113 | + null, |
|
114 | + esc_html__('The price type ID', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLOutputField( |
|
117 | + 'isDeleted', |
|
118 | + 'Boolean', |
|
119 | + 'deleted', |
|
120 | + esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
121 | + ), |
|
122 | + new GraphQLField( |
|
123 | + 'isDefault', |
|
124 | + 'Boolean', |
|
125 | + 'is_default', |
|
126 | + esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
127 | + ), |
|
128 | + new GraphQLOutputField( |
|
129 | + 'isPercent', |
|
130 | + 'Boolean', |
|
131 | + 'is_percent', |
|
132 | + esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
133 | + ), |
|
134 | + new GraphQLOutputField( |
|
135 | + 'isBasePrice', |
|
136 | + 'Boolean', |
|
137 | + 'is_base_price', |
|
138 | + esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
139 | + ), |
|
140 | + new GraphQLOutputField( |
|
141 | + 'isDiscount', |
|
142 | + 'Boolean', |
|
143 | + 'is_discount', |
|
144 | + esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
145 | + ), |
|
146 | + new GraphQLOutputField( |
|
147 | + 'wpUser', |
|
148 | + 'User', |
|
149 | + null, |
|
150 | + esc_html__('Price Creator', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLInputField( |
|
153 | + 'wpUser', |
|
154 | + 'Int', |
|
155 | + null, |
|
156 | + esc_html__('Price Creator ID', 'event_espresso') |
|
157 | + ), |
|
158 | + ]; |
|
159 | + } |
|
160 | 160 | |
161 | 161 | |
162 | - /** |
|
163 | - * @param array $inputFields The mutation input fields. |
|
164 | - * @throws InvalidArgumentException |
|
165 | - * @throws ReflectionException |
|
166 | - * @since $VID:$ |
|
167 | - */ |
|
168 | - public function registerMutations(array $inputFields) |
|
169 | - { |
|
170 | - // Register mutation to update an entity. |
|
171 | - register_graphql_mutation( |
|
172 | - 'update' . $this->name(), |
|
173 | - [ |
|
174 | - 'inputFields' => $inputFields, |
|
175 | - 'outputFields' => [ |
|
176 | - lcfirst($this->name()) => [ |
|
177 | - 'type' => $this->name(), |
|
178 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
179 | - ], |
|
180 | - ], |
|
181 | - 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
182 | - ] |
|
183 | - ); |
|
184 | - // Register mutation to delete an entity. |
|
185 | - register_graphql_mutation( |
|
186 | - 'delete' . $this->name(), |
|
187 | - [ |
|
188 | - 'inputFields' => [ |
|
189 | - 'id' => $inputFields['id'], |
|
190 | - 'deletePermanently' => [ |
|
191 | - 'type' => 'Boolean', |
|
192 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
193 | - ], |
|
194 | - ], |
|
195 | - 'outputFields' => [ |
|
196 | - lcfirst($this->name()) => [ |
|
197 | - 'type' => $this->name(), |
|
198 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
199 | - 'resolve' => static function ($payload) { |
|
200 | - $deleted = (object) $payload['deleted']; |
|
162 | + /** |
|
163 | + * @param array $inputFields The mutation input fields. |
|
164 | + * @throws InvalidArgumentException |
|
165 | + * @throws ReflectionException |
|
166 | + * @since $VID:$ |
|
167 | + */ |
|
168 | + public function registerMutations(array $inputFields) |
|
169 | + { |
|
170 | + // Register mutation to update an entity. |
|
171 | + register_graphql_mutation( |
|
172 | + 'update' . $this->name(), |
|
173 | + [ |
|
174 | + 'inputFields' => $inputFields, |
|
175 | + 'outputFields' => [ |
|
176 | + lcfirst($this->name()) => [ |
|
177 | + 'type' => $this->name(), |
|
178 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
179 | + ], |
|
180 | + ], |
|
181 | + 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
182 | + ] |
|
183 | + ); |
|
184 | + // Register mutation to delete an entity. |
|
185 | + register_graphql_mutation( |
|
186 | + 'delete' . $this->name(), |
|
187 | + [ |
|
188 | + 'inputFields' => [ |
|
189 | + 'id' => $inputFields['id'], |
|
190 | + 'deletePermanently' => [ |
|
191 | + 'type' => 'Boolean', |
|
192 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
193 | + ], |
|
194 | + ], |
|
195 | + 'outputFields' => [ |
|
196 | + lcfirst($this->name()) => [ |
|
197 | + 'type' => $this->name(), |
|
198 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
199 | + 'resolve' => static function ($payload) { |
|
200 | + $deleted = (object) $payload['deleted']; |
|
201 | 201 | |
202 | - return ! empty($deleted) ? $deleted : null; |
|
203 | - }, |
|
204 | - ], |
|
205 | - ], |
|
206 | - 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
207 | - ] |
|
208 | - ); |
|
202 | + return ! empty($deleted) ? $deleted : null; |
|
203 | + }, |
|
204 | + ], |
|
205 | + ], |
|
206 | + 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
207 | + ] |
|
208 | + ); |
|
209 | 209 | |
210 | - // remove primary key from input. |
|
211 | - unset($inputFields['id']); |
|
212 | - // Register mutation to update an entity. |
|
213 | - register_graphql_mutation( |
|
214 | - 'create' . $this->name(), |
|
215 | - [ |
|
216 | - 'inputFields' => $inputFields, |
|
217 | - 'outputFields' => [ |
|
218 | - lcfirst($this->name()) => [ |
|
219 | - 'type' => $this->name(), |
|
220 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
221 | - ], |
|
222 | - ], |
|
223 | - 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
224 | - ] |
|
225 | - ); |
|
226 | - } |
|
210 | + // remove primary key from input. |
|
211 | + unset($inputFields['id']); |
|
212 | + // Register mutation to update an entity. |
|
213 | + register_graphql_mutation( |
|
214 | + 'create' . $this->name(), |
|
215 | + [ |
|
216 | + 'inputFields' => $inputFields, |
|
217 | + 'outputFields' => [ |
|
218 | + lcfirst($this->name()) => [ |
|
219 | + 'type' => $this->name(), |
|
220 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
221 | + ], |
|
222 | + ], |
|
223 | + 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
224 | + ] |
|
225 | + ); |
|
226 | + } |
|
227 | 227 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | // Register mutation to update an entity. |
225 | 225 | register_graphql_mutation( |
226 | - 'update' . $this->name(), |
|
226 | + 'update'.$this->name(), |
|
227 | 227 | [ |
228 | 228 | 'inputFields' => $inputFields, |
229 | 229 | 'outputFields' => [ |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ); |
238 | 238 | // Register mutation to delete an entity. |
239 | 239 | register_graphql_mutation( |
240 | - 'delete' . $this->name(), |
|
240 | + 'delete'.$this->name(), |
|
241 | 241 | [ |
242 | 242 | 'inputFields' => [ |
243 | 243 | 'id' => $inputFields['id'], |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | lcfirst($this->name()) => [ |
251 | 251 | 'type' => $this->name(), |
252 | 252 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
253 | - 'resolve' => static function ($payload) { |
|
253 | + 'resolve' => static function($payload) { |
|
254 | 254 | $deleted = (object) $payload['deleted']; |
255 | 255 | |
256 | 256 | return ! empty($deleted) ? $deleted : null; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | unset($inputFields['id']); |
266 | 266 | // Register mutation to update an entity. |
267 | 267 | register_graphql_mutation( |
268 | - 'create' . $this->name(), |
|
268 | + 'create'.$this->name(), |
|
269 | 269 | [ |
270 | 270 | 'inputFields' => $inputFields, |
271 | 271 | 'outputFields' => [ |
@@ -22,88 +22,88 @@ |
||
22 | 22 | class PriceType extends TypeBase |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * PriceType constructor. |
|
27 | - * |
|
28 | - * @param EEM_Price_Type $price_type_model |
|
29 | - */ |
|
30 | - public function __construct(EEM_Price_Type $price_type_model) |
|
31 | - { |
|
32 | - $this->model = $price_type_model; |
|
33 | - $this->setName('PriceType'); |
|
34 | - $this->setDescription(__('A price type.', 'event_espresso')); |
|
35 | - $this->setIsCustomPostType(false); |
|
36 | - parent::__construct(); |
|
37 | - } |
|
25 | + /** |
|
26 | + * PriceType constructor. |
|
27 | + * |
|
28 | + * @param EEM_Price_Type $price_type_model |
|
29 | + */ |
|
30 | + public function __construct(EEM_Price_Type $price_type_model) |
|
31 | + { |
|
32 | + $this->model = $price_type_model; |
|
33 | + $this->setName('PriceType'); |
|
34 | + $this->setDescription(__('A price type.', 'event_espresso')); |
|
35 | + $this->setIsCustomPostType(false); |
|
36 | + parent::__construct(); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * @return GraphQLFieldInterface[] |
|
42 | - * @since $VID:$ |
|
43 | - */ |
|
44 | - public function getFields() |
|
45 | - { |
|
46 | - return [ |
|
47 | - new GraphQLField( |
|
48 | - 'id', |
|
49 | - ['non_null' => 'ID'], |
|
50 | - null, |
|
51 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
52 | - ), |
|
53 | - new GraphQLOutputField( |
|
54 | - 'dbId', |
|
55 | - ['non_null' => 'Int'], |
|
56 | - 'ID', |
|
57 | - esc_html__('Price type ID', 'event_espresso') |
|
58 | - ), |
|
59 | - new GraphQLField( |
|
60 | - 'name', |
|
61 | - 'String', |
|
62 | - 'name', |
|
63 | - esc_html__('Price type Name', 'event_espresso') |
|
64 | - ), |
|
65 | - new GraphQLField( |
|
66 | - 'baseType', |
|
67 | - 'PriceBaseTypeEnum', |
|
68 | - 'base_type', |
|
69 | - esc_html__('Price Base type', 'event_espresso') |
|
70 | - ), |
|
71 | - new GraphQLField( |
|
72 | - 'order', |
|
73 | - 'Int', |
|
74 | - 'order', |
|
75 | - esc_html__('Order in which price should be applied.', 'event_espresso') |
|
76 | - ), |
|
77 | - new GraphQLField( |
|
78 | - 'isPercent', |
|
79 | - 'Boolean', |
|
80 | - 'is_percent', |
|
81 | - esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
82 | - ), |
|
83 | - new GraphQLOutputField( |
|
84 | - 'isDiscount', |
|
85 | - 'Boolean', |
|
86 | - 'is_discount', |
|
87 | - esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
88 | - ), |
|
89 | - new GraphQLField( |
|
90 | - 'isDeleted', |
|
91 | - 'Boolean', |
|
92 | - 'deleted', |
|
93 | - esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
94 | - ), |
|
95 | - new GraphQLOutputField( |
|
96 | - 'wpUser', |
|
97 | - 'User', |
|
98 | - null, |
|
99 | - esc_html__('Price Type Creator', 'event_espresso') |
|
100 | - ), |
|
101 | - new GraphQLInputField( |
|
102 | - 'wpUser', |
|
103 | - 'Int', |
|
104 | - null, |
|
105 | - esc_html__('Price Type Creator ID', 'event_espresso') |
|
106 | - ), |
|
107 | - ]; |
|
108 | - } |
|
40 | + /** |
|
41 | + * @return GraphQLFieldInterface[] |
|
42 | + * @since $VID:$ |
|
43 | + */ |
|
44 | + public function getFields() |
|
45 | + { |
|
46 | + return [ |
|
47 | + new GraphQLField( |
|
48 | + 'id', |
|
49 | + ['non_null' => 'ID'], |
|
50 | + null, |
|
51 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
52 | + ), |
|
53 | + new GraphQLOutputField( |
|
54 | + 'dbId', |
|
55 | + ['non_null' => 'Int'], |
|
56 | + 'ID', |
|
57 | + esc_html__('Price type ID', 'event_espresso') |
|
58 | + ), |
|
59 | + new GraphQLField( |
|
60 | + 'name', |
|
61 | + 'String', |
|
62 | + 'name', |
|
63 | + esc_html__('Price type Name', 'event_espresso') |
|
64 | + ), |
|
65 | + new GraphQLField( |
|
66 | + 'baseType', |
|
67 | + 'PriceBaseTypeEnum', |
|
68 | + 'base_type', |
|
69 | + esc_html__('Price Base type', 'event_espresso') |
|
70 | + ), |
|
71 | + new GraphQLField( |
|
72 | + 'order', |
|
73 | + 'Int', |
|
74 | + 'order', |
|
75 | + esc_html__('Order in which price should be applied.', 'event_espresso') |
|
76 | + ), |
|
77 | + new GraphQLField( |
|
78 | + 'isPercent', |
|
79 | + 'Boolean', |
|
80 | + 'is_percent', |
|
81 | + esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
82 | + ), |
|
83 | + new GraphQLOutputField( |
|
84 | + 'isDiscount', |
|
85 | + 'Boolean', |
|
86 | + 'is_discount', |
|
87 | + esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
88 | + ), |
|
89 | + new GraphQLField( |
|
90 | + 'isDeleted', |
|
91 | + 'Boolean', |
|
92 | + 'deleted', |
|
93 | + esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
94 | + ), |
|
95 | + new GraphQLOutputField( |
|
96 | + 'wpUser', |
|
97 | + 'User', |
|
98 | + null, |
|
99 | + esc_html__('Price Type Creator', 'event_espresso') |
|
100 | + ), |
|
101 | + new GraphQLInputField( |
|
102 | + 'wpUser', |
|
103 | + 'Int', |
|
104 | + null, |
|
105 | + esc_html__('Price Type Creator ID', 'event_espresso') |
|
106 | + ), |
|
107 | + ]; |
|
108 | + } |
|
109 | 109 | } |