@@ -20,82 +20,82 @@ |
||
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->setName($this->namespace . 'State'); |
|
31 | - $this->setDescription(__('A state', 'event_espresso')); |
|
32 | - $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->setName($this->namespace . 'State'); |
|
31 | + $this->setDescription(__('A state', 'event_espresso')); |
|
32 | + $this->setIsCustomPostType(false); |
|
33 | 33 | |
34 | - parent::__construct($state_model); |
|
35 | - } |
|
34 | + parent::__construct($state_model); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @return GraphQLFieldInterface[] |
|
40 | - */ |
|
41 | - public function getFields(): array |
|
42 | - { |
|
43 | - $fields = [ |
|
44 | - new GraphQLField( |
|
45 | - 'id', |
|
46 | - ['non_null' => 'ID'], |
|
47 | - null, |
|
48 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
49 | - ), |
|
50 | - new GraphQLOutputField( |
|
51 | - 'dbId', |
|
52 | - ['non_null' => 'Int'], |
|
53 | - 'ID', |
|
54 | - esc_html__('State ID', 'event_espresso') |
|
55 | - ), |
|
56 | - new GraphQLField( |
|
57 | - 'abbreviation', |
|
58 | - 'String', |
|
59 | - 'abbrev', |
|
60 | - esc_html__('State Abbreviation', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLOutputField( |
|
63 | - 'cacheId', |
|
64 | - ['non_null' => 'String'], |
|
65 | - null, |
|
66 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'name', |
|
70 | - 'String', |
|
71 | - 'name', |
|
72 | - esc_html__('State Name', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'isActive', |
|
76 | - 'Boolean', |
|
77 | - 'active', |
|
78 | - esc_html__('State Active Flag', 'event_espresso') |
|
79 | - ), |
|
80 | - new GraphQLOutputField( |
|
81 | - 'country', |
|
82 | - $this->namespace . 'Country', |
|
83 | - null, |
|
84 | - esc_html__('Country for the state', 'event_espresso') |
|
85 | - ), |
|
86 | - new GraphQLInputField( |
|
87 | - 'country', |
|
88 | - 'String', |
|
89 | - null, |
|
90 | - esc_html__('Country ISO Code', 'event_espresso') |
|
91 | - ), |
|
92 | - ]; |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + */ |
|
41 | + public function getFields(): array |
|
42 | + { |
|
43 | + $fields = [ |
|
44 | + new GraphQLField( |
|
45 | + 'id', |
|
46 | + ['non_null' => 'ID'], |
|
47 | + null, |
|
48 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
49 | + ), |
|
50 | + new GraphQLOutputField( |
|
51 | + 'dbId', |
|
52 | + ['non_null' => 'Int'], |
|
53 | + 'ID', |
|
54 | + esc_html__('State ID', 'event_espresso') |
|
55 | + ), |
|
56 | + new GraphQLField( |
|
57 | + 'abbreviation', |
|
58 | + 'String', |
|
59 | + 'abbrev', |
|
60 | + esc_html__('State Abbreviation', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLOutputField( |
|
63 | + 'cacheId', |
|
64 | + ['non_null' => 'String'], |
|
65 | + null, |
|
66 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'name', |
|
70 | + 'String', |
|
71 | + 'name', |
|
72 | + esc_html__('State Name', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'isActive', |
|
76 | + 'Boolean', |
|
77 | + 'active', |
|
78 | + esc_html__('State Active Flag', 'event_espresso') |
|
79 | + ), |
|
80 | + new GraphQLOutputField( |
|
81 | + 'country', |
|
82 | + $this->namespace . 'Country', |
|
83 | + null, |
|
84 | + esc_html__('Country for the state', 'event_espresso') |
|
85 | + ), |
|
86 | + new GraphQLInputField( |
|
87 | + 'country', |
|
88 | + 'String', |
|
89 | + null, |
|
90 | + esc_html__('Country ISO Code', 'event_espresso') |
|
91 | + ), |
|
92 | + ]; |
|
93 | 93 | |
94 | - return apply_filters( |
|
95 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__state_fields', |
|
96 | - $fields, |
|
97 | - $this->name, |
|
98 | - $this->model |
|
99 | - ); |
|
100 | - } |
|
94 | + return apply_filters( |
|
95 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__state_fields', |
|
96 | + $fields, |
|
97 | + $this->name, |
|
98 | + $this->model |
|
99 | + ); |
|
100 | + } |
|
101 | 101 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct(EEM_State $state_model) |
29 | 29 | { |
30 | - $this->setName($this->namespace . 'State'); |
|
30 | + $this->setName($this->namespace.'State'); |
|
31 | 31 | $this->setDescription(__('A state', 'event_espresso')); |
32 | 32 | $this->setIsCustomPostType(false); |
33 | 33 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ), |
80 | 80 | new GraphQLOutputField( |
81 | 81 | 'country', |
82 | - $this->namespace . 'Country', |
|
82 | + $this->namespace.'Country', |
|
83 | 83 | null, |
84 | 84 | esc_html__('Country for the state', 'event_espresso') |
85 | 85 | ), |
@@ -34,390 +34,390 @@ |
||
34 | 34 | class Ticket extends TypeBase |
35 | 35 | { |
36 | 36 | |
37 | - /** |
|
38 | - * Ticket constructor. |
|
39 | - * |
|
40 | - * @param EEM_Ticket $ticket_model |
|
41 | - */ |
|
42 | - public function __construct(EEM_Ticket $ticket_model) |
|
43 | - { |
|
44 | - $this->setName($this->namespace . 'Ticket'); |
|
45 | - $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
46 | - $this->setIsCustomPostType(false); |
|
47 | - parent::__construct($ticket_model); |
|
48 | - } |
|
37 | + /** |
|
38 | + * Ticket constructor. |
|
39 | + * |
|
40 | + * @param EEM_Ticket $ticket_model |
|
41 | + */ |
|
42 | + public function __construct(EEM_Ticket $ticket_model) |
|
43 | + { |
|
44 | + $this->setName($this->namespace . 'Ticket'); |
|
45 | + $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
46 | + $this->setIsCustomPostType(false); |
|
47 | + parent::__construct($ticket_model); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * @return GraphQLFieldInterface[] |
|
53 | - */ |
|
54 | - public function getFields(): array |
|
55 | - { |
|
56 | - $fields = [ |
|
57 | - new GraphQLField( |
|
58 | - 'id', |
|
59 | - ['non_null' => 'ID'], |
|
60 | - null, |
|
61 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLOutputField( |
|
64 | - 'dbId', |
|
65 | - ['non_null' => 'Int'], |
|
66 | - 'ID', |
|
67 | - esc_html__('Ticket ID', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLOutputField( |
|
70 | - 'cacheId', |
|
71 | - ['non_null' => 'String'], |
|
72 | - null, |
|
73 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLInputField( |
|
76 | - 'datetimes', |
|
77 | - ['list_of' => 'ID'], |
|
78 | - null, |
|
79 | - sprintf( |
|
80 | - '%1$s %2$s', |
|
81 | - esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
82 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
83 | - ) |
|
84 | - ), |
|
85 | - new GraphQLField( |
|
86 | - 'description', |
|
87 | - 'String', |
|
88 | - 'description', |
|
89 | - esc_html__('Description of Ticket', 'event_espresso') |
|
90 | - ), |
|
91 | - new GraphQLField( |
|
92 | - 'endDate', |
|
93 | - 'String', |
|
94 | - 'end_date', |
|
95 | - esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
96 | - [$this, 'formatDatetime'] |
|
97 | - ), |
|
98 | - new GraphQLOutputField( |
|
99 | - 'event', |
|
100 | - $this->namespace . 'Event', |
|
101 | - null, |
|
102 | - esc_html__('Event of the ticket.', 'event_espresso') |
|
103 | - ), |
|
104 | - new GraphQLField( |
|
105 | - 'isDefault', |
|
106 | - 'Boolean', |
|
107 | - 'is_default', |
|
108 | - esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLOutputField( |
|
111 | - 'isExpired', |
|
112 | - 'Boolean', |
|
113 | - 'is_expired', |
|
114 | - esc_html__('Flag indicating ticket is no longer available because its available dates have expired', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLOutputField( |
|
117 | - 'isFree', |
|
118 | - 'Boolean', |
|
119 | - 'is_free', |
|
120 | - esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
121 | - ), |
|
122 | - new GraphQLOutputField( |
|
123 | - 'isOnSale', |
|
124 | - 'Boolean', |
|
125 | - 'is_on_sale', |
|
126 | - esc_html__('Flag indicating ticket ticket is on sale or not', 'event_espresso') |
|
127 | - ), |
|
128 | - new GraphQLOutputField( |
|
129 | - 'isPending', |
|
130 | - 'Boolean', |
|
131 | - 'is_pending', |
|
132 | - esc_html__('Flag indicating ticket is yet to go on sale or not', 'event_espresso') |
|
133 | - ), |
|
134 | - new GraphQLField( |
|
135 | - 'isRequired', |
|
136 | - 'Boolean', |
|
137 | - 'required', |
|
138 | - esc_html__( |
|
139 | - 'Flag indicating whether this ticket must be purchased with a transaction', |
|
140 | - 'event_espresso' |
|
141 | - ) |
|
142 | - ), |
|
143 | - new GraphQLOutputField( |
|
144 | - 'isSoldOut', |
|
145 | - 'Boolean', |
|
146 | - null, |
|
147 | - esc_html__('Flag indicating whether the ticket is sold out', 'event_espresso'), |
|
148 | - null, |
|
149 | - [$this, 'getIsSoldOut'] |
|
150 | - ), |
|
151 | - new GraphQLField( |
|
152 | - 'isTaxable', |
|
153 | - 'Boolean', |
|
154 | - 'taxable', |
|
155 | - esc_html__( |
|
156 | - 'Flag indicating whether there is tax applied on this ticket', |
|
157 | - 'event_espresso' |
|
158 | - ) |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'isTrashed', |
|
162 | - 'Boolean', |
|
163 | - 'deleted', |
|
164 | - esc_html__('Flag indicating ticket has been trashed.', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'max', |
|
168 | - 'Int', |
|
169 | - 'max', |
|
170 | - esc_html__( |
|
171 | - 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
172 | - 'event_espresso' |
|
173 | - ), |
|
174 | - [$this, 'parseInfiniteValue'] |
|
175 | - ), |
|
176 | - new GraphQLField( |
|
177 | - 'min', |
|
178 | - 'Int', |
|
179 | - 'min', |
|
180 | - esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
181 | - ), |
|
182 | - new GraphQLField( |
|
183 | - 'name', |
|
184 | - 'String', |
|
185 | - 'name', |
|
186 | - esc_html__('Ticket Name', 'event_espresso') |
|
187 | - ), |
|
188 | - new GraphQLField( |
|
189 | - 'order', |
|
190 | - 'Int', |
|
191 | - 'order', |
|
192 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
193 | - ), |
|
194 | - new GraphQLOutputField( |
|
195 | - 'parent', |
|
196 | - $this->name(), |
|
197 | - null, |
|
198 | - esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
199 | - ), |
|
200 | - new GraphQLInputField( |
|
201 | - 'parent', |
|
202 | - 'ID', |
|
203 | - null, |
|
204 | - esc_html__('The parent ticket ID', 'event_espresso') |
|
205 | - ), |
|
206 | - new GraphQLField( |
|
207 | - 'price', |
|
208 | - 'Float', |
|
209 | - 'price', |
|
210 | - esc_html__('Final calculated price for ticket', 'event_espresso') |
|
211 | - ), |
|
212 | - new GraphQLInputField( |
|
213 | - 'prices', |
|
214 | - ['list_of' => 'ID'], |
|
215 | - null, |
|
216 | - sprintf( |
|
217 | - '%1$s %2$s', |
|
218 | - esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
219 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
220 | - ) |
|
221 | - ), |
|
222 | - new GraphQLField( |
|
223 | - 'quantity', |
|
224 | - 'Int', |
|
225 | - 'qty', |
|
226 | - esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
227 | - [$this, 'parseInfiniteValue'] |
|
228 | - ), |
|
229 | - new GraphQLOutputField( |
|
230 | - 'registrationCount', |
|
231 | - 'Int', |
|
232 | - 'count_registrations', |
|
233 | - esc_html__('Number of registrations for the ticket', 'event_espresso') |
|
234 | - ), |
|
235 | - new GraphQLField( |
|
236 | - 'reserved', |
|
237 | - 'Int', |
|
238 | - 'reserved', |
|
239 | - esc_html__( |
|
240 | - 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
241 | - 'event_espresso' |
|
242 | - ) |
|
243 | - ), |
|
244 | - new GraphQLField( |
|
245 | - 'reverseCalculate', |
|
246 | - 'Boolean', |
|
247 | - 'reverse_calculate', |
|
248 | - esc_html__( |
|
249 | - 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
250 | - 'event_espresso' |
|
251 | - ) |
|
252 | - ), |
|
253 | - new GraphQLField( |
|
254 | - 'row', |
|
255 | - 'Int', |
|
256 | - 'row', |
|
257 | - esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
258 | - ), |
|
259 | - new GraphQLField( |
|
260 | - 'sold', |
|
261 | - 'Int', |
|
262 | - 'sold', |
|
263 | - esc_html__('Number of this ticket sold', 'event_espresso') |
|
264 | - ), |
|
265 | - new GraphQLOutputField( |
|
266 | - 'status', |
|
267 | - $this->namespace . 'TicketStatusEnum', |
|
268 | - 'ticket_status', |
|
269 | - esc_html__('Ticket status', 'event_espresso') |
|
270 | - ), |
|
271 | - new GraphQLField( |
|
272 | - 'startDate', |
|
273 | - 'String', |
|
274 | - 'start_date', |
|
275 | - esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
276 | - [$this, 'formatDatetime'] |
|
277 | - ), |
|
278 | - new GraphQLField( |
|
279 | - 'uses', |
|
280 | - 'Int', |
|
281 | - 'uses', |
|
282 | - esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
283 | - [$this, 'parseInfiniteValue'] |
|
284 | - ), |
|
285 | - new GraphQLField( |
|
286 | - 'visibility', |
|
287 | - $this->namespace . 'TicketVisibilityEnum', |
|
288 | - 'visibility', |
|
289 | - esc_html__('Where the ticket can be viewed throughout the UI', 'event_espresso') |
|
290 | - ), |
|
291 | - new GraphQLOutputField( |
|
292 | - 'wpUser', |
|
293 | - 'User', |
|
294 | - null, |
|
295 | - esc_html__('Ticket Creator', 'event_espresso') |
|
296 | - ), |
|
297 | - new GraphQLOutputField( |
|
298 | - 'userId', |
|
299 | - 'ID', |
|
300 | - null, |
|
301 | - esc_html__('Ticket Creator ID', 'event_espresso') |
|
302 | - ), |
|
303 | - new GraphQLInputField( |
|
304 | - 'wpUser', |
|
305 | - 'Int', |
|
306 | - null, |
|
307 | - esc_html__('Ticket Creator ID', 'event_espresso') |
|
308 | - ), |
|
309 | - ]; |
|
51 | + /** |
|
52 | + * @return GraphQLFieldInterface[] |
|
53 | + */ |
|
54 | + public function getFields(): array |
|
55 | + { |
|
56 | + $fields = [ |
|
57 | + new GraphQLField( |
|
58 | + 'id', |
|
59 | + ['non_null' => 'ID'], |
|
60 | + null, |
|
61 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLOutputField( |
|
64 | + 'dbId', |
|
65 | + ['non_null' => 'Int'], |
|
66 | + 'ID', |
|
67 | + esc_html__('Ticket ID', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLOutputField( |
|
70 | + 'cacheId', |
|
71 | + ['non_null' => 'String'], |
|
72 | + null, |
|
73 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLInputField( |
|
76 | + 'datetimes', |
|
77 | + ['list_of' => 'ID'], |
|
78 | + null, |
|
79 | + sprintf( |
|
80 | + '%1$s %2$s', |
|
81 | + esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
82 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
83 | + ) |
|
84 | + ), |
|
85 | + new GraphQLField( |
|
86 | + 'description', |
|
87 | + 'String', |
|
88 | + 'description', |
|
89 | + esc_html__('Description of Ticket', 'event_espresso') |
|
90 | + ), |
|
91 | + new GraphQLField( |
|
92 | + 'endDate', |
|
93 | + 'String', |
|
94 | + 'end_date', |
|
95 | + esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
96 | + [$this, 'formatDatetime'] |
|
97 | + ), |
|
98 | + new GraphQLOutputField( |
|
99 | + 'event', |
|
100 | + $this->namespace . 'Event', |
|
101 | + null, |
|
102 | + esc_html__('Event of the ticket.', 'event_espresso') |
|
103 | + ), |
|
104 | + new GraphQLField( |
|
105 | + 'isDefault', |
|
106 | + 'Boolean', |
|
107 | + 'is_default', |
|
108 | + esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLOutputField( |
|
111 | + 'isExpired', |
|
112 | + 'Boolean', |
|
113 | + 'is_expired', |
|
114 | + esc_html__('Flag indicating ticket is no longer available because its available dates have expired', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLOutputField( |
|
117 | + 'isFree', |
|
118 | + 'Boolean', |
|
119 | + 'is_free', |
|
120 | + esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
121 | + ), |
|
122 | + new GraphQLOutputField( |
|
123 | + 'isOnSale', |
|
124 | + 'Boolean', |
|
125 | + 'is_on_sale', |
|
126 | + esc_html__('Flag indicating ticket ticket is on sale or not', 'event_espresso') |
|
127 | + ), |
|
128 | + new GraphQLOutputField( |
|
129 | + 'isPending', |
|
130 | + 'Boolean', |
|
131 | + 'is_pending', |
|
132 | + esc_html__('Flag indicating ticket is yet to go on sale or not', 'event_espresso') |
|
133 | + ), |
|
134 | + new GraphQLField( |
|
135 | + 'isRequired', |
|
136 | + 'Boolean', |
|
137 | + 'required', |
|
138 | + esc_html__( |
|
139 | + 'Flag indicating whether this ticket must be purchased with a transaction', |
|
140 | + 'event_espresso' |
|
141 | + ) |
|
142 | + ), |
|
143 | + new GraphQLOutputField( |
|
144 | + 'isSoldOut', |
|
145 | + 'Boolean', |
|
146 | + null, |
|
147 | + esc_html__('Flag indicating whether the ticket is sold out', 'event_espresso'), |
|
148 | + null, |
|
149 | + [$this, 'getIsSoldOut'] |
|
150 | + ), |
|
151 | + new GraphQLField( |
|
152 | + 'isTaxable', |
|
153 | + 'Boolean', |
|
154 | + 'taxable', |
|
155 | + esc_html__( |
|
156 | + 'Flag indicating whether there is tax applied on this ticket', |
|
157 | + 'event_espresso' |
|
158 | + ) |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'isTrashed', |
|
162 | + 'Boolean', |
|
163 | + 'deleted', |
|
164 | + esc_html__('Flag indicating ticket has been trashed.', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'max', |
|
168 | + 'Int', |
|
169 | + 'max', |
|
170 | + esc_html__( |
|
171 | + 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
172 | + 'event_espresso' |
|
173 | + ), |
|
174 | + [$this, 'parseInfiniteValue'] |
|
175 | + ), |
|
176 | + new GraphQLField( |
|
177 | + 'min', |
|
178 | + 'Int', |
|
179 | + 'min', |
|
180 | + esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
181 | + ), |
|
182 | + new GraphQLField( |
|
183 | + 'name', |
|
184 | + 'String', |
|
185 | + 'name', |
|
186 | + esc_html__('Ticket Name', 'event_espresso') |
|
187 | + ), |
|
188 | + new GraphQLField( |
|
189 | + 'order', |
|
190 | + 'Int', |
|
191 | + 'order', |
|
192 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
193 | + ), |
|
194 | + new GraphQLOutputField( |
|
195 | + 'parent', |
|
196 | + $this->name(), |
|
197 | + null, |
|
198 | + esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
199 | + ), |
|
200 | + new GraphQLInputField( |
|
201 | + 'parent', |
|
202 | + 'ID', |
|
203 | + null, |
|
204 | + esc_html__('The parent ticket ID', 'event_espresso') |
|
205 | + ), |
|
206 | + new GraphQLField( |
|
207 | + 'price', |
|
208 | + 'Float', |
|
209 | + 'price', |
|
210 | + esc_html__('Final calculated price for ticket', 'event_espresso') |
|
211 | + ), |
|
212 | + new GraphQLInputField( |
|
213 | + 'prices', |
|
214 | + ['list_of' => 'ID'], |
|
215 | + null, |
|
216 | + sprintf( |
|
217 | + '%1$s %2$s', |
|
218 | + esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
219 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
220 | + ) |
|
221 | + ), |
|
222 | + new GraphQLField( |
|
223 | + 'quantity', |
|
224 | + 'Int', |
|
225 | + 'qty', |
|
226 | + esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
227 | + [$this, 'parseInfiniteValue'] |
|
228 | + ), |
|
229 | + new GraphQLOutputField( |
|
230 | + 'registrationCount', |
|
231 | + 'Int', |
|
232 | + 'count_registrations', |
|
233 | + esc_html__('Number of registrations for the ticket', 'event_espresso') |
|
234 | + ), |
|
235 | + new GraphQLField( |
|
236 | + 'reserved', |
|
237 | + 'Int', |
|
238 | + 'reserved', |
|
239 | + esc_html__( |
|
240 | + 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
241 | + 'event_espresso' |
|
242 | + ) |
|
243 | + ), |
|
244 | + new GraphQLField( |
|
245 | + 'reverseCalculate', |
|
246 | + 'Boolean', |
|
247 | + 'reverse_calculate', |
|
248 | + esc_html__( |
|
249 | + 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
250 | + 'event_espresso' |
|
251 | + ) |
|
252 | + ), |
|
253 | + new GraphQLField( |
|
254 | + 'row', |
|
255 | + 'Int', |
|
256 | + 'row', |
|
257 | + esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
258 | + ), |
|
259 | + new GraphQLField( |
|
260 | + 'sold', |
|
261 | + 'Int', |
|
262 | + 'sold', |
|
263 | + esc_html__('Number of this ticket sold', 'event_espresso') |
|
264 | + ), |
|
265 | + new GraphQLOutputField( |
|
266 | + 'status', |
|
267 | + $this->namespace . 'TicketStatusEnum', |
|
268 | + 'ticket_status', |
|
269 | + esc_html__('Ticket status', 'event_espresso') |
|
270 | + ), |
|
271 | + new GraphQLField( |
|
272 | + 'startDate', |
|
273 | + 'String', |
|
274 | + 'start_date', |
|
275 | + esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
276 | + [$this, 'formatDatetime'] |
|
277 | + ), |
|
278 | + new GraphQLField( |
|
279 | + 'uses', |
|
280 | + 'Int', |
|
281 | + 'uses', |
|
282 | + esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
283 | + [$this, 'parseInfiniteValue'] |
|
284 | + ), |
|
285 | + new GraphQLField( |
|
286 | + 'visibility', |
|
287 | + $this->namespace . 'TicketVisibilityEnum', |
|
288 | + 'visibility', |
|
289 | + esc_html__('Where the ticket can be viewed throughout the UI', 'event_espresso') |
|
290 | + ), |
|
291 | + new GraphQLOutputField( |
|
292 | + 'wpUser', |
|
293 | + 'User', |
|
294 | + null, |
|
295 | + esc_html__('Ticket Creator', 'event_espresso') |
|
296 | + ), |
|
297 | + new GraphQLOutputField( |
|
298 | + 'userId', |
|
299 | + 'ID', |
|
300 | + null, |
|
301 | + esc_html__('Ticket Creator ID', 'event_espresso') |
|
302 | + ), |
|
303 | + new GraphQLInputField( |
|
304 | + 'wpUser', |
|
305 | + 'Int', |
|
306 | + null, |
|
307 | + esc_html__('Ticket Creator ID', 'event_espresso') |
|
308 | + ), |
|
309 | + ]; |
|
310 | 310 | |
311 | - return apply_filters( |
|
312 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__ticket_fields', |
|
313 | - $fields, |
|
314 | - $this->name, |
|
315 | - $this->model |
|
316 | - ); |
|
317 | - } |
|
311 | + return apply_filters( |
|
312 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__ticket_fields', |
|
313 | + $fields, |
|
314 | + $this->name, |
|
315 | + $this->model |
|
316 | + ); |
|
317 | + } |
|
318 | 318 | |
319 | 319 | |
320 | - /** |
|
321 | - * @param EE_Ticket $source The source that's passed down the GraphQL queries |
|
322 | - * @param array $args The inputArgs on the field |
|
323 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
324 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
325 | - * @return bool |
|
326 | - * @throws Exception |
|
327 | - * @throws InvalidArgumentException |
|
328 | - * @throws InvalidDataTypeException |
|
329 | - * @throws InvalidInterfaceException |
|
330 | - * @throws ReflectionException |
|
331 | - * @throws UserError |
|
332 | - * @throws UnexpectedEntityException |
|
333 | - * @since $VID:$ |
|
334 | - */ |
|
335 | - public function getIsSoldOut(EE_Ticket $source, array $args, AppContext $context, ResolveInfo $info): bool |
|
336 | - { |
|
337 | - return $source->ticket_status() === EE_Ticket::sold_out; |
|
338 | - } |
|
320 | + /** |
|
321 | + * @param EE_Ticket $source The source that's passed down the GraphQL queries |
|
322 | + * @param array $args The inputArgs on the field |
|
323 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
324 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
325 | + * @return bool |
|
326 | + * @throws Exception |
|
327 | + * @throws InvalidArgumentException |
|
328 | + * @throws InvalidDataTypeException |
|
329 | + * @throws InvalidInterfaceException |
|
330 | + * @throws ReflectionException |
|
331 | + * @throws UserError |
|
332 | + * @throws UnexpectedEntityException |
|
333 | + * @since $VID:$ |
|
334 | + */ |
|
335 | + public function getIsSoldOut(EE_Ticket $source, array $args, AppContext $context, ResolveInfo $info): bool |
|
336 | + { |
|
337 | + return $source->ticket_status() === EE_Ticket::sold_out; |
|
338 | + } |
|
339 | 339 | |
340 | 340 | |
341 | - /** |
|
342 | - * @param array $inputFields The mutation input fields. |
|
343 | - * @throws InvalidArgumentException |
|
344 | - * @throws ReflectionException |
|
345 | - * @throws Exception |
|
346 | - */ |
|
347 | - public function registerMutations(array $inputFields) |
|
348 | - { |
|
349 | - register_graphql_input_type( |
|
350 | - 'Update' . $this->name() . 'BaseInput', |
|
351 | - [ |
|
352 | - 'fields' => $inputFields, |
|
353 | - ] |
|
354 | - ); |
|
355 | - // Register mutation to update an entity. |
|
356 | - register_graphql_mutation( |
|
357 | - 'update' . $this->name(), |
|
358 | - [ |
|
359 | - 'inputFields' => $inputFields, |
|
360 | - 'outputFields' => [ |
|
361 | - lcfirst($this->name()) => [ |
|
362 | - 'type' => $this->name(), |
|
363 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
364 | - ], |
|
365 | - ], |
|
366 | - 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
367 | - ] |
|
368 | - ); |
|
369 | - $base_input = 'Update' . $this->name() . 'BaseInput'; |
|
370 | - // Register mutation to update an entity. |
|
371 | - register_graphql_mutation( |
|
372 | - 'bulkUpdate' . $this->name(), |
|
373 | - array_merge( |
|
374 | - Datetime::bulkUpdateBaseConfig($base_input), |
|
375 | - [ |
|
376 | - 'mutateAndGetPayload' => TicketBulkUpdate::mutateAndGetPayload($this->model, $this), |
|
377 | - ] |
|
378 | - ) |
|
379 | - ); |
|
380 | - // Register mutation to delete an entity. |
|
381 | - register_graphql_mutation( |
|
382 | - 'delete' . $this->name(), |
|
383 | - [ |
|
384 | - 'inputFields' => [ |
|
385 | - 'id' => $inputFields['id'], |
|
386 | - 'deletePermanently' => [ |
|
387 | - 'type' => 'Boolean', |
|
388 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
389 | - ], |
|
390 | - ], |
|
391 | - 'outputFields' => [ |
|
392 | - lcfirst($this->name()) => [ |
|
393 | - 'type' => $this->name(), |
|
394 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
395 | - 'resolve' => static function ($payload) { |
|
396 | - $deleted = (object) $payload['deleted']; |
|
341 | + /** |
|
342 | + * @param array $inputFields The mutation input fields. |
|
343 | + * @throws InvalidArgumentException |
|
344 | + * @throws ReflectionException |
|
345 | + * @throws Exception |
|
346 | + */ |
|
347 | + public function registerMutations(array $inputFields) |
|
348 | + { |
|
349 | + register_graphql_input_type( |
|
350 | + 'Update' . $this->name() . 'BaseInput', |
|
351 | + [ |
|
352 | + 'fields' => $inputFields, |
|
353 | + ] |
|
354 | + ); |
|
355 | + // Register mutation to update an entity. |
|
356 | + register_graphql_mutation( |
|
357 | + 'update' . $this->name(), |
|
358 | + [ |
|
359 | + 'inputFields' => $inputFields, |
|
360 | + 'outputFields' => [ |
|
361 | + lcfirst($this->name()) => [ |
|
362 | + 'type' => $this->name(), |
|
363 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
364 | + ], |
|
365 | + ], |
|
366 | + 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
367 | + ] |
|
368 | + ); |
|
369 | + $base_input = 'Update' . $this->name() . 'BaseInput'; |
|
370 | + // Register mutation to update an entity. |
|
371 | + register_graphql_mutation( |
|
372 | + 'bulkUpdate' . $this->name(), |
|
373 | + array_merge( |
|
374 | + Datetime::bulkUpdateBaseConfig($base_input), |
|
375 | + [ |
|
376 | + 'mutateAndGetPayload' => TicketBulkUpdate::mutateAndGetPayload($this->model, $this), |
|
377 | + ] |
|
378 | + ) |
|
379 | + ); |
|
380 | + // Register mutation to delete an entity. |
|
381 | + register_graphql_mutation( |
|
382 | + 'delete' . $this->name(), |
|
383 | + [ |
|
384 | + 'inputFields' => [ |
|
385 | + 'id' => $inputFields['id'], |
|
386 | + 'deletePermanently' => [ |
|
387 | + 'type' => 'Boolean', |
|
388 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
389 | + ], |
|
390 | + ], |
|
391 | + 'outputFields' => [ |
|
392 | + lcfirst($this->name()) => [ |
|
393 | + 'type' => $this->name(), |
|
394 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
395 | + 'resolve' => static function ($payload) { |
|
396 | + $deleted = (object) $payload['deleted']; |
|
397 | 397 | |
398 | - return ! empty($deleted) ? $deleted : null; |
|
399 | - }, |
|
400 | - ], |
|
401 | - ], |
|
402 | - 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
403 | - ] |
|
404 | - ); |
|
398 | + return ! empty($deleted) ? $deleted : null; |
|
399 | + }, |
|
400 | + ], |
|
401 | + ], |
|
402 | + 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
403 | + ] |
|
404 | + ); |
|
405 | 405 | |
406 | - // remove primary key from input. |
|
407 | - unset($inputFields['id']); |
|
408 | - // Register mutation to update an entity. |
|
409 | - register_graphql_mutation( |
|
410 | - 'create' . $this->name(), |
|
411 | - [ |
|
412 | - 'inputFields' => $inputFields, |
|
413 | - 'outputFields' => [ |
|
414 | - lcfirst($this->name()) => [ |
|
415 | - 'type' => $this->name(), |
|
416 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
417 | - ], |
|
418 | - ], |
|
419 | - 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
420 | - ] |
|
421 | - ); |
|
422 | - } |
|
406 | + // remove primary key from input. |
|
407 | + unset($inputFields['id']); |
|
408 | + // Register mutation to update an entity. |
|
409 | + register_graphql_mutation( |
|
410 | + 'create' . $this->name(), |
|
411 | + [ |
|
412 | + 'inputFields' => $inputFields, |
|
413 | + 'outputFields' => [ |
|
414 | + lcfirst($this->name()) => [ |
|
415 | + 'type' => $this->name(), |
|
416 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
417 | + ], |
|
418 | + ], |
|
419 | + 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
420 | + ] |
|
421 | + ); |
|
422 | + } |
|
423 | 423 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function __construct(EEM_Ticket $ticket_model) |
43 | 43 | { |
44 | - $this->setName($this->namespace . 'Ticket'); |
|
44 | + $this->setName($this->namespace.'Ticket'); |
|
45 | 45 | $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
46 | 46 | $this->setIsCustomPostType(false); |
47 | 47 | parent::__construct($ticket_model); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ), |
98 | 98 | new GraphQLOutputField( |
99 | 99 | 'event', |
100 | - $this->namespace . 'Event', |
|
100 | + $this->namespace.'Event', |
|
101 | 101 | null, |
102 | 102 | esc_html__('Event of the ticket.', 'event_espresso') |
103 | 103 | ), |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | ), |
265 | 265 | new GraphQLOutputField( |
266 | 266 | 'status', |
267 | - $this->namespace . 'TicketStatusEnum', |
|
267 | + $this->namespace.'TicketStatusEnum', |
|
268 | 268 | 'ticket_status', |
269 | 269 | esc_html__('Ticket status', 'event_espresso') |
270 | 270 | ), |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | ), |
285 | 285 | new GraphQLField( |
286 | 286 | 'visibility', |
287 | - $this->namespace . 'TicketVisibilityEnum', |
|
287 | + $this->namespace.'TicketVisibilityEnum', |
|
288 | 288 | 'visibility', |
289 | 289 | esc_html__('Where the ticket can be viewed throughout the UI', 'event_espresso') |
290 | 290 | ), |
@@ -347,14 +347,14 @@ discard block |
||
347 | 347 | public function registerMutations(array $inputFields) |
348 | 348 | { |
349 | 349 | register_graphql_input_type( |
350 | - 'Update' . $this->name() . 'BaseInput', |
|
350 | + 'Update'.$this->name().'BaseInput', |
|
351 | 351 | [ |
352 | 352 | 'fields' => $inputFields, |
353 | 353 | ] |
354 | 354 | ); |
355 | 355 | // Register mutation to update an entity. |
356 | 356 | register_graphql_mutation( |
357 | - 'update' . $this->name(), |
|
357 | + 'update'.$this->name(), |
|
358 | 358 | [ |
359 | 359 | 'inputFields' => $inputFields, |
360 | 360 | 'outputFields' => [ |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
367 | 367 | ] |
368 | 368 | ); |
369 | - $base_input = 'Update' . $this->name() . 'BaseInput'; |
|
369 | + $base_input = 'Update'.$this->name().'BaseInput'; |
|
370 | 370 | // Register mutation to update an entity. |
371 | 371 | register_graphql_mutation( |
372 | - 'bulkUpdate' . $this->name(), |
|
372 | + 'bulkUpdate'.$this->name(), |
|
373 | 373 | array_merge( |
374 | 374 | Datetime::bulkUpdateBaseConfig($base_input), |
375 | 375 | [ |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | ); |
380 | 380 | // Register mutation to delete an entity. |
381 | 381 | register_graphql_mutation( |
382 | - 'delete' . $this->name(), |
|
382 | + 'delete'.$this->name(), |
|
383 | 383 | [ |
384 | 384 | 'inputFields' => [ |
385 | 385 | 'id' => $inputFields['id'], |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | lcfirst($this->name()) => [ |
393 | 393 | 'type' => $this->name(), |
394 | 394 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
395 | - 'resolve' => static function ($payload) { |
|
395 | + 'resolve' => static function($payload) { |
|
396 | 396 | $deleted = (object) $payload['deleted']; |
397 | 397 | |
398 | 398 | return ! empty($deleted) ? $deleted : null; |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | unset($inputFields['id']); |
408 | 408 | // Register mutation to update an entity. |
409 | 409 | register_graphql_mutation( |
410 | - 'create' . $this->name(), |
|
410 | + 'create'.$this->name(), |
|
411 | 411 | [ |
412 | 412 | 'inputFields' => $inputFields, |
413 | 413 | 'outputFields' => [ |
@@ -26,228 +26,228 @@ |
||
26 | 26 | class Price extends TypeBase |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * Price constructor. |
|
31 | - * |
|
32 | - * @param EEM_Price $price_model |
|
33 | - */ |
|
34 | - public function __construct(EEM_Price $price_model) |
|
35 | - { |
|
36 | - $this->setName($this->namespace . 'Price'); |
|
37 | - $this->setDescription(__('A price.', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct($price_model); |
|
40 | - } |
|
29 | + /** |
|
30 | + * Price constructor. |
|
31 | + * |
|
32 | + * @param EEM_Price $price_model |
|
33 | + */ |
|
34 | + public function __construct(EEM_Price $price_model) |
|
35 | + { |
|
36 | + $this->setName($this->namespace . 'Price'); |
|
37 | + $this->setDescription(__('A price.', 'event_espresso')); |
|
38 | + $this->setIsCustomPostType(false); |
|
39 | + parent::__construct($price_model); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @return GraphQLFieldInterface[] |
|
45 | - * @since $VID:$ |
|
46 | - */ |
|
47 | - public function getFields(): array |
|
48 | - { |
|
49 | - $fields = [ |
|
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 | - 'amount', |
|
64 | - 'Float', |
|
65 | - 'amount', |
|
66 | - esc_html__('Price Amount', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLOutputField( |
|
69 | - 'cacheId', |
|
70 | - ['non_null' => 'String'], |
|
71 | - null, |
|
72 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'description', |
|
76 | - 'String', |
|
77 | - 'desc', |
|
78 | - esc_html__('Price description', 'event_espresso') |
|
79 | - ), |
|
80 | - new GraphQLOutputField( |
|
81 | - 'isBasePrice', |
|
82 | - 'Boolean', |
|
83 | - 'is_base_price', |
|
84 | - esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
85 | - ), |
|
86 | - new GraphQLField( |
|
87 | - 'isDefault', |
|
88 | - 'Boolean', |
|
89 | - 'is_default', |
|
90 | - esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
91 | - ), |
|
92 | - new GraphQLOutputField( |
|
93 | - 'isDiscount', |
|
94 | - 'Boolean', |
|
95 | - 'is_discount', |
|
96 | - esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
97 | - ), |
|
98 | - new GraphQLOutputField( |
|
99 | - 'isPercent', |
|
100 | - 'Boolean', |
|
101 | - 'is_percent', |
|
102 | - esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
103 | - ), |
|
104 | - new GraphQLOutputField( |
|
105 | - 'isTax', |
|
106 | - 'Boolean', |
|
107 | - 'is_tax', |
|
108 | - esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLField( |
|
111 | - 'isTrashed', |
|
112 | - 'Boolean', |
|
113 | - 'deleted', |
|
114 | - esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLField( |
|
117 | - 'name', |
|
118 | - 'String', |
|
119 | - 'name', |
|
120 | - esc_html__('Price Name', 'event_espresso') |
|
121 | - ), |
|
122 | - new GraphQLField( |
|
123 | - 'order', |
|
124 | - 'Int', |
|
125 | - 'order', |
|
126 | - esc_html__('Order of Application of Price.', 'event_espresso') |
|
127 | - ), |
|
128 | - new GraphQLField( |
|
129 | - 'overrides', |
|
130 | - 'Int', |
|
131 | - 'overrides', |
|
132 | - esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
133 | - ), |
|
134 | - new GraphQLOutputField( |
|
135 | - 'parent', |
|
136 | - $this->name(), |
|
137 | - null, |
|
138 | - esc_html__('The parent price of the current price', 'event_espresso') |
|
139 | - ), |
|
140 | - new GraphQLInputField( |
|
141 | - 'parent', |
|
142 | - 'ID', |
|
143 | - null, |
|
144 | - esc_html__('The parent price ID', 'event_espresso') |
|
145 | - ), |
|
146 | - new GraphQLOutputField( |
|
147 | - 'priceType', |
|
148 | - $this->namespace . 'PriceType', |
|
149 | - 'type_obj', |
|
150 | - esc_html__('The related price type object.', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLInputField( |
|
153 | - 'priceType', |
|
154 | - 'ID', |
|
155 | - null, |
|
156 | - esc_html__('The price type ID', 'event_espresso') |
|
157 | - ), |
|
158 | - new GraphQLOutputField( |
|
159 | - 'wpUser', |
|
160 | - 'User', |
|
161 | - null, |
|
162 | - esc_html__('Price Creator', 'event_espresso') |
|
163 | - ), |
|
164 | - new GraphQLOutputField( |
|
165 | - 'userId', |
|
166 | - 'ID', |
|
167 | - null, |
|
168 | - esc_html__('Price Creator ID', 'event_espresso') |
|
169 | - ), |
|
170 | - new GraphQLInputField( |
|
171 | - 'wpUser', |
|
172 | - 'Int', |
|
173 | - null, |
|
174 | - esc_html__('Price Creator ID', 'event_espresso') |
|
175 | - ), |
|
176 | - ]; |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields(): array |
|
48 | + { |
|
49 | + $fields = [ |
|
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 | + 'amount', |
|
64 | + 'Float', |
|
65 | + 'amount', |
|
66 | + esc_html__('Price Amount', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLOutputField( |
|
69 | + 'cacheId', |
|
70 | + ['non_null' => 'String'], |
|
71 | + null, |
|
72 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'description', |
|
76 | + 'String', |
|
77 | + 'desc', |
|
78 | + esc_html__('Price description', 'event_espresso') |
|
79 | + ), |
|
80 | + new GraphQLOutputField( |
|
81 | + 'isBasePrice', |
|
82 | + 'Boolean', |
|
83 | + 'is_base_price', |
|
84 | + esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
85 | + ), |
|
86 | + new GraphQLField( |
|
87 | + 'isDefault', |
|
88 | + 'Boolean', |
|
89 | + 'is_default', |
|
90 | + esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
91 | + ), |
|
92 | + new GraphQLOutputField( |
|
93 | + 'isDiscount', |
|
94 | + 'Boolean', |
|
95 | + 'is_discount', |
|
96 | + esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
97 | + ), |
|
98 | + new GraphQLOutputField( |
|
99 | + 'isPercent', |
|
100 | + 'Boolean', |
|
101 | + 'is_percent', |
|
102 | + esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
103 | + ), |
|
104 | + new GraphQLOutputField( |
|
105 | + 'isTax', |
|
106 | + 'Boolean', |
|
107 | + 'is_tax', |
|
108 | + esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLField( |
|
111 | + 'isTrashed', |
|
112 | + 'Boolean', |
|
113 | + 'deleted', |
|
114 | + esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLField( |
|
117 | + 'name', |
|
118 | + 'String', |
|
119 | + 'name', |
|
120 | + esc_html__('Price Name', 'event_espresso') |
|
121 | + ), |
|
122 | + new GraphQLField( |
|
123 | + 'order', |
|
124 | + 'Int', |
|
125 | + 'order', |
|
126 | + esc_html__('Order of Application of Price.', 'event_espresso') |
|
127 | + ), |
|
128 | + new GraphQLField( |
|
129 | + 'overrides', |
|
130 | + 'Int', |
|
131 | + 'overrides', |
|
132 | + esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
133 | + ), |
|
134 | + new GraphQLOutputField( |
|
135 | + 'parent', |
|
136 | + $this->name(), |
|
137 | + null, |
|
138 | + esc_html__('The parent price of the current price', 'event_espresso') |
|
139 | + ), |
|
140 | + new GraphQLInputField( |
|
141 | + 'parent', |
|
142 | + 'ID', |
|
143 | + null, |
|
144 | + esc_html__('The parent price ID', 'event_espresso') |
|
145 | + ), |
|
146 | + new GraphQLOutputField( |
|
147 | + 'priceType', |
|
148 | + $this->namespace . 'PriceType', |
|
149 | + 'type_obj', |
|
150 | + esc_html__('The related price type object.', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLInputField( |
|
153 | + 'priceType', |
|
154 | + 'ID', |
|
155 | + null, |
|
156 | + esc_html__('The price type ID', 'event_espresso') |
|
157 | + ), |
|
158 | + new GraphQLOutputField( |
|
159 | + 'wpUser', |
|
160 | + 'User', |
|
161 | + null, |
|
162 | + esc_html__('Price Creator', 'event_espresso') |
|
163 | + ), |
|
164 | + new GraphQLOutputField( |
|
165 | + 'userId', |
|
166 | + 'ID', |
|
167 | + null, |
|
168 | + esc_html__('Price Creator ID', 'event_espresso') |
|
169 | + ), |
|
170 | + new GraphQLInputField( |
|
171 | + 'wpUser', |
|
172 | + 'Int', |
|
173 | + null, |
|
174 | + esc_html__('Price Creator ID', 'event_espresso') |
|
175 | + ), |
|
176 | + ]; |
|
177 | 177 | |
178 | - return apply_filters( |
|
179 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__price_fields', |
|
180 | - $fields, |
|
181 | - $this->name, |
|
182 | - $this->model |
|
183 | - ); |
|
184 | - } |
|
178 | + return apply_filters( |
|
179 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__price_fields', |
|
180 | + $fields, |
|
181 | + $this->name, |
|
182 | + $this->model |
|
183 | + ); |
|
184 | + } |
|
185 | 185 | |
186 | 186 | |
187 | - /** |
|
188 | - * @param array $inputFields The mutation input fields. |
|
189 | - * @throws InvalidArgumentException |
|
190 | - * @throws ReflectionException |
|
191 | - * @throws Exception |
|
192 | - * @since $VID:$ |
|
193 | - */ |
|
194 | - public function registerMutations(array $inputFields) |
|
195 | - { |
|
196 | - // Register mutation to update an entity. |
|
197 | - register_graphql_mutation( |
|
198 | - 'update' . $this->name(), |
|
199 | - [ |
|
200 | - 'inputFields' => $inputFields, |
|
201 | - 'outputFields' => [ |
|
202 | - lcfirst($this->name()) => [ |
|
203 | - 'type' => $this->name(), |
|
204 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
205 | - ], |
|
206 | - ], |
|
207 | - 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
208 | - ] |
|
209 | - ); |
|
210 | - // Register mutation to delete an entity. |
|
211 | - register_graphql_mutation( |
|
212 | - 'delete' . $this->name(), |
|
213 | - [ |
|
214 | - 'inputFields' => [ |
|
215 | - 'id' => $inputFields['id'], |
|
216 | - 'deletePermanently' => [ |
|
217 | - 'type' => 'Boolean', |
|
218 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
219 | - ], |
|
220 | - ], |
|
221 | - 'outputFields' => [ |
|
222 | - lcfirst($this->name()) => [ |
|
223 | - 'type' => $this->name(), |
|
224 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
225 | - 'resolve' => static function ($payload) { |
|
226 | - $deleted = (object) $payload['deleted']; |
|
187 | + /** |
|
188 | + * @param array $inputFields The mutation input fields. |
|
189 | + * @throws InvalidArgumentException |
|
190 | + * @throws ReflectionException |
|
191 | + * @throws Exception |
|
192 | + * @since $VID:$ |
|
193 | + */ |
|
194 | + public function registerMutations(array $inputFields) |
|
195 | + { |
|
196 | + // Register mutation to update an entity. |
|
197 | + register_graphql_mutation( |
|
198 | + 'update' . $this->name(), |
|
199 | + [ |
|
200 | + 'inputFields' => $inputFields, |
|
201 | + 'outputFields' => [ |
|
202 | + lcfirst($this->name()) => [ |
|
203 | + 'type' => $this->name(), |
|
204 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
205 | + ], |
|
206 | + ], |
|
207 | + 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
208 | + ] |
|
209 | + ); |
|
210 | + // Register mutation to delete an entity. |
|
211 | + register_graphql_mutation( |
|
212 | + 'delete' . $this->name(), |
|
213 | + [ |
|
214 | + 'inputFields' => [ |
|
215 | + 'id' => $inputFields['id'], |
|
216 | + 'deletePermanently' => [ |
|
217 | + 'type' => 'Boolean', |
|
218 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
219 | + ], |
|
220 | + ], |
|
221 | + 'outputFields' => [ |
|
222 | + lcfirst($this->name()) => [ |
|
223 | + 'type' => $this->name(), |
|
224 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
225 | + 'resolve' => static function ($payload) { |
|
226 | + $deleted = (object) $payload['deleted']; |
|
227 | 227 | |
228 | - return ! empty($deleted) ? $deleted : null; |
|
229 | - }, |
|
230 | - ], |
|
231 | - ], |
|
232 | - 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
233 | - ] |
|
234 | - ); |
|
228 | + return ! empty($deleted) ? $deleted : null; |
|
229 | + }, |
|
230 | + ], |
|
231 | + ], |
|
232 | + 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
233 | + ] |
|
234 | + ); |
|
235 | 235 | |
236 | - // remove primary key from input. |
|
237 | - unset($inputFields['id']); |
|
238 | - // Register mutation to update an entity. |
|
239 | - register_graphql_mutation( |
|
240 | - 'create' . $this->name(), |
|
241 | - [ |
|
242 | - 'inputFields' => $inputFields, |
|
243 | - 'outputFields' => [ |
|
244 | - lcfirst($this->name()) => [ |
|
245 | - 'type' => $this->name(), |
|
246 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
247 | - ], |
|
248 | - ], |
|
249 | - 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
250 | - ] |
|
251 | - ); |
|
252 | - } |
|
236 | + // remove primary key from input. |
|
237 | + unset($inputFields['id']); |
|
238 | + // Register mutation to update an entity. |
|
239 | + register_graphql_mutation( |
|
240 | + 'create' . $this->name(), |
|
241 | + [ |
|
242 | + 'inputFields' => $inputFields, |
|
243 | + 'outputFields' => [ |
|
244 | + lcfirst($this->name()) => [ |
|
245 | + 'type' => $this->name(), |
|
246 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
247 | + ], |
|
248 | + ], |
|
249 | + 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
250 | + ] |
|
251 | + ); |
|
252 | + } |
|
253 | 253 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct(EEM_Price $price_model) |
35 | 35 | { |
36 | - $this->setName($this->namespace . 'Price'); |
|
36 | + $this->setName($this->namespace.'Price'); |
|
37 | 37 | $this->setDescription(__('A price.', 'event_espresso')); |
38 | 38 | $this->setIsCustomPostType(false); |
39 | 39 | parent::__construct($price_model); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ), |
146 | 146 | new GraphQLOutputField( |
147 | 147 | 'priceType', |
148 | - $this->namespace . 'PriceType', |
|
148 | + $this->namespace.'PriceType', |
|
149 | 149 | 'type_obj', |
150 | 150 | esc_html__('The related price type object.', 'event_espresso') |
151 | 151 | ), |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | { |
196 | 196 | // Register mutation to update an entity. |
197 | 197 | register_graphql_mutation( |
198 | - 'update' . $this->name(), |
|
198 | + 'update'.$this->name(), |
|
199 | 199 | [ |
200 | 200 | 'inputFields' => $inputFields, |
201 | 201 | 'outputFields' => [ |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | ); |
210 | 210 | // Register mutation to delete an entity. |
211 | 211 | register_graphql_mutation( |
212 | - 'delete' . $this->name(), |
|
212 | + 'delete'.$this->name(), |
|
213 | 213 | [ |
214 | 214 | 'inputFields' => [ |
215 | 215 | 'id' => $inputFields['id'], |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | lcfirst($this->name()) => [ |
223 | 223 | 'type' => $this->name(), |
224 | 224 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
225 | - 'resolve' => static function ($payload) { |
|
225 | + 'resolve' => static function($payload) { |
|
226 | 226 | $deleted = (object) $payload['deleted']; |
227 | 227 | |
228 | 228 | return ! empty($deleted) ? $deleted : null; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | unset($inputFields['id']); |
238 | 238 | // Register mutation to update an entity. |
239 | 239 | register_graphql_mutation( |
240 | - 'create' . $this->name(), |
|
240 | + 'create'.$this->name(), |
|
241 | 241 | [ |
242 | 242 | 'inputFields' => $inputFields, |
243 | 243 | 'outputFields' => [ |
@@ -21,199 +21,199 @@ |
||
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->setName($this->namespace . 'Venue'); |
|
32 | - $this->setIsCustomPostType(true); |
|
33 | - parent::__construct($venue_model); |
|
34 | - } |
|
24 | + /** |
|
25 | + * Venue constructor. |
|
26 | + * |
|
27 | + * @param EEM_Venue $venue_model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Venue $venue_model) |
|
30 | + { |
|
31 | + $this->setName($this->namespace . 'Venue'); |
|
32 | + $this->setIsCustomPostType(true); |
|
33 | + parent::__construct($venue_model); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return GraphQLFieldInterface[] |
|
39 | - */ |
|
40 | - public function getFields(): array |
|
41 | - { |
|
42 | - $fields = [ |
|
43 | - new GraphQLOutputField( |
|
44 | - 'dbId', |
|
45 | - ['non_null' => 'Int'], |
|
46 | - 'ID', |
|
47 | - esc_html__('The venue ID.', 'event_espresso') |
|
48 | - ), |
|
49 | - new GraphQLOutputField( |
|
50 | - 'cacheId', |
|
51 | - ['non_null' => 'String'], |
|
52 | - null, |
|
53 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
54 | - ), |
|
55 | - new GraphQLField( |
|
56 | - 'name', |
|
57 | - 'String', |
|
58 | - 'name', |
|
59 | - esc_html__('Venue Name', 'event_espresso') |
|
60 | - ), |
|
61 | - new GraphQLField( |
|
62 | - 'description', |
|
63 | - 'String', |
|
64 | - 'description', |
|
65 | - esc_html__('Venue Description', 'event_espresso') |
|
66 | - ), |
|
67 | - new GraphQLField( |
|
68 | - 'shortDescription', |
|
69 | - 'String', |
|
70 | - 'excerpt', |
|
71 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
72 | - ), |
|
73 | - new GraphQLField( |
|
74 | - 'identifier', |
|
75 | - 'String', |
|
76 | - 'identifier', |
|
77 | - esc_html__('Venue Identifier', 'event_espresso') |
|
78 | - ), |
|
79 | - new GraphQLField( |
|
80 | - 'created', |
|
81 | - 'String', |
|
82 | - 'created', |
|
83 | - esc_html__('Date Venue Created', 'event_espresso') |
|
84 | - ), |
|
85 | - new GraphQLField( |
|
86 | - 'order', |
|
87 | - 'Int', |
|
88 | - 'order', |
|
89 | - esc_html__('Venue order', 'event_espresso') |
|
90 | - ), |
|
91 | - new GraphQLOutputField( |
|
92 | - 'wpUser', |
|
93 | - 'User', |
|
94 | - null, |
|
95 | - esc_html__('Venue Creator', 'event_espresso') |
|
96 | - ), |
|
97 | - new GraphQLInputField( |
|
98 | - 'wpUser', |
|
99 | - 'Int', |
|
100 | - null, |
|
101 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
102 | - ), |
|
103 | - new GraphQLField( |
|
104 | - 'address', |
|
105 | - 'String', |
|
106 | - 'address', |
|
107 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
108 | - ), |
|
109 | - new GraphQLField( |
|
110 | - 'address2', |
|
111 | - 'String', |
|
112 | - 'address2', |
|
113 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
114 | - ), |
|
115 | - new GraphQLField( |
|
116 | - 'city', |
|
117 | - 'String', |
|
118 | - 'city', |
|
119 | - esc_html__('Venue City', 'event_espresso') |
|
120 | - ), |
|
121 | - new GraphQLOutputField( |
|
122 | - 'state', |
|
123 | - $this->namespace . 'State', |
|
124 | - null, |
|
125 | - esc_html__('Venue state', 'event_espresso') |
|
126 | - ), |
|
127 | - new GraphQLInputField( |
|
128 | - 'state', |
|
129 | - 'Int', |
|
130 | - null, |
|
131 | - esc_html__('State ID', 'event_espresso') |
|
132 | - ), |
|
133 | - new GraphQLOutputField( |
|
134 | - 'country', |
|
135 | - $this->namespace . 'Country', |
|
136 | - null, |
|
137 | - esc_html__('Venue country', 'event_espresso') |
|
138 | - ), |
|
139 | - new GraphQLInputField( |
|
140 | - 'country', |
|
141 | - 'String', |
|
142 | - null, |
|
143 | - esc_html__('Country ISO Code', 'event_espresso') |
|
144 | - ), |
|
145 | - new GraphQLField( |
|
146 | - 'zip', |
|
147 | - 'String', |
|
148 | - 'zip', |
|
149 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
150 | - ), |
|
151 | - new GraphQLField( |
|
152 | - 'capacity', |
|
153 | - 'Int', |
|
154 | - 'capacity', |
|
155 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
156 | - [$this, 'parseInfiniteValue'] |
|
157 | - ), |
|
158 | - new GraphQLField( |
|
159 | - 'phone', |
|
160 | - 'String', |
|
161 | - 'phone', |
|
162 | - esc_html__('Venue Phone', 'event_espresso') |
|
163 | - ), |
|
164 | - new GraphQLField( |
|
165 | - 'virtualPhone', |
|
166 | - 'String', |
|
167 | - 'virtual_phone', |
|
168 | - esc_html__('Call in Number', 'event_espresso') |
|
169 | - ), |
|
170 | - new GraphQLField( |
|
171 | - 'url', |
|
172 | - 'String', |
|
173 | - 'venue_url', |
|
174 | - esc_html__('Venue Website', 'event_espresso') |
|
175 | - ), |
|
176 | - new GraphQLField( |
|
177 | - 'virtualUrl', |
|
178 | - 'String', |
|
179 | - 'virtual_url', |
|
180 | - esc_html__('Virtual URL', 'event_espresso') |
|
181 | - ), |
|
182 | - new GraphQLField( |
|
183 | - 'googleMapLink', |
|
184 | - 'String', |
|
185 | - 'google_map_link', |
|
186 | - esc_html__('Google Map Link', 'event_espresso') |
|
187 | - ), |
|
188 | - new GraphQLField( |
|
189 | - 'enableForGmap', |
|
190 | - 'String', |
|
191 | - 'enable_for_gmap', |
|
192 | - esc_html__('Show Google Map?', 'event_espresso') |
|
193 | - ), |
|
194 | - ]; |
|
37 | + /** |
|
38 | + * @return GraphQLFieldInterface[] |
|
39 | + */ |
|
40 | + public function getFields(): array |
|
41 | + { |
|
42 | + $fields = [ |
|
43 | + new GraphQLOutputField( |
|
44 | + 'dbId', |
|
45 | + ['non_null' => 'Int'], |
|
46 | + 'ID', |
|
47 | + esc_html__('The venue ID.', 'event_espresso') |
|
48 | + ), |
|
49 | + new GraphQLOutputField( |
|
50 | + 'cacheId', |
|
51 | + ['non_null' => 'String'], |
|
52 | + null, |
|
53 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
54 | + ), |
|
55 | + new GraphQLField( |
|
56 | + 'name', |
|
57 | + 'String', |
|
58 | + 'name', |
|
59 | + esc_html__('Venue Name', 'event_espresso') |
|
60 | + ), |
|
61 | + new GraphQLField( |
|
62 | + 'description', |
|
63 | + 'String', |
|
64 | + 'description', |
|
65 | + esc_html__('Venue Description', 'event_espresso') |
|
66 | + ), |
|
67 | + new GraphQLField( |
|
68 | + 'shortDescription', |
|
69 | + 'String', |
|
70 | + 'excerpt', |
|
71 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
72 | + ), |
|
73 | + new GraphQLField( |
|
74 | + 'identifier', |
|
75 | + 'String', |
|
76 | + 'identifier', |
|
77 | + esc_html__('Venue Identifier', 'event_espresso') |
|
78 | + ), |
|
79 | + new GraphQLField( |
|
80 | + 'created', |
|
81 | + 'String', |
|
82 | + 'created', |
|
83 | + esc_html__('Date Venue Created', 'event_espresso') |
|
84 | + ), |
|
85 | + new GraphQLField( |
|
86 | + 'order', |
|
87 | + 'Int', |
|
88 | + 'order', |
|
89 | + esc_html__('Venue order', 'event_espresso') |
|
90 | + ), |
|
91 | + new GraphQLOutputField( |
|
92 | + 'wpUser', |
|
93 | + 'User', |
|
94 | + null, |
|
95 | + esc_html__('Venue Creator', 'event_espresso') |
|
96 | + ), |
|
97 | + new GraphQLInputField( |
|
98 | + 'wpUser', |
|
99 | + 'Int', |
|
100 | + null, |
|
101 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
102 | + ), |
|
103 | + new GraphQLField( |
|
104 | + 'address', |
|
105 | + 'String', |
|
106 | + 'address', |
|
107 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
108 | + ), |
|
109 | + new GraphQLField( |
|
110 | + 'address2', |
|
111 | + 'String', |
|
112 | + 'address2', |
|
113 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
114 | + ), |
|
115 | + new GraphQLField( |
|
116 | + 'city', |
|
117 | + 'String', |
|
118 | + 'city', |
|
119 | + esc_html__('Venue City', 'event_espresso') |
|
120 | + ), |
|
121 | + new GraphQLOutputField( |
|
122 | + 'state', |
|
123 | + $this->namespace . 'State', |
|
124 | + null, |
|
125 | + esc_html__('Venue state', 'event_espresso') |
|
126 | + ), |
|
127 | + new GraphQLInputField( |
|
128 | + 'state', |
|
129 | + 'Int', |
|
130 | + null, |
|
131 | + esc_html__('State ID', 'event_espresso') |
|
132 | + ), |
|
133 | + new GraphQLOutputField( |
|
134 | + 'country', |
|
135 | + $this->namespace . 'Country', |
|
136 | + null, |
|
137 | + esc_html__('Venue country', 'event_espresso') |
|
138 | + ), |
|
139 | + new GraphQLInputField( |
|
140 | + 'country', |
|
141 | + 'String', |
|
142 | + null, |
|
143 | + esc_html__('Country ISO Code', 'event_espresso') |
|
144 | + ), |
|
145 | + new GraphQLField( |
|
146 | + 'zip', |
|
147 | + 'String', |
|
148 | + 'zip', |
|
149 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
150 | + ), |
|
151 | + new GraphQLField( |
|
152 | + 'capacity', |
|
153 | + 'Int', |
|
154 | + 'capacity', |
|
155 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
156 | + [$this, 'parseInfiniteValue'] |
|
157 | + ), |
|
158 | + new GraphQLField( |
|
159 | + 'phone', |
|
160 | + 'String', |
|
161 | + 'phone', |
|
162 | + esc_html__('Venue Phone', 'event_espresso') |
|
163 | + ), |
|
164 | + new GraphQLField( |
|
165 | + 'virtualPhone', |
|
166 | + 'String', |
|
167 | + 'virtual_phone', |
|
168 | + esc_html__('Call in Number', 'event_espresso') |
|
169 | + ), |
|
170 | + new GraphQLField( |
|
171 | + 'url', |
|
172 | + 'String', |
|
173 | + 'venue_url', |
|
174 | + esc_html__('Venue Website', 'event_espresso') |
|
175 | + ), |
|
176 | + new GraphQLField( |
|
177 | + 'virtualUrl', |
|
178 | + 'String', |
|
179 | + 'virtual_url', |
|
180 | + esc_html__('Virtual URL', 'event_espresso') |
|
181 | + ), |
|
182 | + new GraphQLField( |
|
183 | + 'googleMapLink', |
|
184 | + 'String', |
|
185 | + 'google_map_link', |
|
186 | + esc_html__('Google Map Link', 'event_espresso') |
|
187 | + ), |
|
188 | + new GraphQLField( |
|
189 | + 'enableForGmap', |
|
190 | + 'String', |
|
191 | + 'enable_for_gmap', |
|
192 | + esc_html__('Show Google Map?', 'event_espresso') |
|
193 | + ), |
|
194 | + ]; |
|
195 | 195 | |
196 | - return apply_filters( |
|
197 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
198 | - $fields, |
|
199 | - $this->name, |
|
200 | - $this->model |
|
201 | - ); |
|
202 | - } |
|
196 | + return apply_filters( |
|
197 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
198 | + $fields, |
|
199 | + $this->name, |
|
200 | + $this->model |
|
201 | + ); |
|
202 | + } |
|
203 | 203 | |
204 | 204 | |
205 | - /** |
|
206 | - * Extends the existing WP GraphQL mutations. |
|
207 | - * |
|
208 | - * @return void |
|
209 | - */ |
|
210 | - public function extendMutations() |
|
211 | - { |
|
212 | - add_action( |
|
213 | - 'graphql_post_object_mutation_update_additional_data', |
|
214 | - VenueUpdate::mutateFields($this->model, $this), |
|
215 | - 10, |
|
216 | - 6 |
|
217 | - ); |
|
218 | - } |
|
205 | + /** |
|
206 | + * Extends the existing WP GraphQL mutations. |
|
207 | + * |
|
208 | + * @return void |
|
209 | + */ |
|
210 | + public function extendMutations() |
|
211 | + { |
|
212 | + add_action( |
|
213 | + 'graphql_post_object_mutation_update_additional_data', |
|
214 | + VenueUpdate::mutateFields($this->model, $this), |
|
215 | + 10, |
|
216 | + 6 |
|
217 | + ); |
|
218 | + } |
|
219 | 219 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct(EEM_Venue $venue_model) |
30 | 30 | { |
31 | - $this->setName($this->namespace . 'Venue'); |
|
31 | + $this->setName($this->namespace.'Venue'); |
|
32 | 32 | $this->setIsCustomPostType(true); |
33 | 33 | parent::__construct($venue_model); |
34 | 34 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | ), |
121 | 121 | new GraphQLOutputField( |
122 | 122 | 'state', |
123 | - $this->namespace . 'State', |
|
123 | + $this->namespace.'State', |
|
124 | 124 | null, |
125 | 125 | esc_html__('Venue state', 'event_espresso') |
126 | 126 | ), |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ), |
133 | 133 | new GraphQLOutputField( |
134 | 134 | 'country', |
135 | - $this->namespace . 'Country', |
|
135 | + $this->namespace.'Country', |
|
136 | 136 | null, |
137 | 137 | esc_html__('Venue country', 'event_espresso') |
138 | 138 | ), |
@@ -36,409 +36,409 @@ |
||
36 | 36 | class Datetime extends TypeBase |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * EventDate constructor. |
|
41 | - * |
|
42 | - * @param EEM_Datetime $datetime_model |
|
43 | - */ |
|
44 | - public function __construct(EEM_Datetime $datetime_model) |
|
45 | - { |
|
46 | - $this->setName($this->namespace . 'Datetime'); |
|
47 | - $this->setDescription(__('An event date', 'event_espresso')); |
|
48 | - $this->setIsCustomPostType(false); |
|
49 | - parent::__construct($datetime_model); |
|
50 | - } |
|
39 | + /** |
|
40 | + * EventDate constructor. |
|
41 | + * |
|
42 | + * @param EEM_Datetime $datetime_model |
|
43 | + */ |
|
44 | + public function __construct(EEM_Datetime $datetime_model) |
|
45 | + { |
|
46 | + $this->setName($this->namespace . 'Datetime'); |
|
47 | + $this->setDescription(__('An event date', 'event_espresso')); |
|
48 | + $this->setIsCustomPostType(false); |
|
49 | + parent::__construct($datetime_model); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * @return GraphQLFieldInterface[] |
|
55 | - */ |
|
56 | - public function getFields(): array |
|
57 | - { |
|
58 | - $fields = [ |
|
59 | - new GraphQLField( |
|
60 | - 'id', |
|
61 | - ['non_null' => 'ID'], |
|
62 | - null, |
|
63 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
64 | - ), |
|
65 | - new GraphQLOutputField( |
|
66 | - 'dbId', |
|
67 | - ['non_null' => 'Int'], |
|
68 | - 'ID', |
|
69 | - esc_html__('The datetime ID.', 'event_espresso') |
|
70 | - ), |
|
71 | - new GraphQLOutputField( |
|
72 | - 'cacheId', |
|
73 | - ['non_null' => 'String'], |
|
74 | - null, |
|
75 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
76 | - ), |
|
77 | - new GraphQLField( |
|
78 | - 'capacity', |
|
79 | - 'Int', |
|
80 | - 'reg_limit', |
|
81 | - esc_html__('Registration Limit for this time', 'event_espresso'), |
|
82 | - [$this, 'parseInfiniteValue'] |
|
83 | - ), |
|
84 | - new GraphQLField( |
|
85 | - 'description', |
|
86 | - 'String', |
|
87 | - 'description', |
|
88 | - esc_html__('Description for Datetime', 'event_espresso') |
|
89 | - ), |
|
90 | - new GraphQLField( |
|
91 | - 'endDate', |
|
92 | - 'String', |
|
93 | - 'end_date_and_time', |
|
94 | - esc_html__('End date and time of the Event', 'event_espresso'), |
|
95 | - [$this, 'formatDatetime'] |
|
96 | - ), |
|
97 | - new GraphQLOutputField( |
|
98 | - 'event', |
|
99 | - $this->namespace . 'Event', |
|
100 | - null, |
|
101 | - esc_html__('Event of the datetime.', 'event_espresso') |
|
102 | - ), |
|
103 | - new GraphQLInputField( |
|
104 | - 'event', |
|
105 | - 'ID', |
|
106 | - null, |
|
107 | - esc_html__('Globally unique event ID of the datetime.', 'event_espresso') |
|
108 | - ), |
|
109 | - new GraphQLInputField( |
|
110 | - 'eventId', |
|
111 | - 'Int', |
|
112 | - null, |
|
113 | - esc_html__('Event ID of the datetime.', 'event_espresso') |
|
114 | - ), |
|
115 | - new GraphQLOutputField( |
|
116 | - 'isActive', |
|
117 | - 'Boolean', |
|
118 | - 'is_active', |
|
119 | - esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
120 | - ), |
|
121 | - new GraphQLOutputField( |
|
122 | - 'isExpired', |
|
123 | - 'Boolean', |
|
124 | - 'is_expired', |
|
125 | - esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
126 | - ), |
|
127 | - new GraphQLField( |
|
128 | - 'isPrimary', |
|
129 | - 'Boolean', |
|
130 | - 'is_primary', |
|
131 | - esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
132 | - ), |
|
133 | - new GraphQLOutputField( |
|
134 | - 'isSoldOut', |
|
135 | - 'Boolean', |
|
136 | - 'sold_out', |
|
137 | - esc_html__( |
|
138 | - 'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
139 | - 'event_espresso' |
|
140 | - ) |
|
141 | - ), |
|
142 | - new GraphQLField( |
|
143 | - 'isTrashed', |
|
144 | - 'Boolean', |
|
145 | - null, |
|
146 | - esc_html__('Flag indicating datetime has been trashed.', 'event_espresso'), |
|
147 | - null, |
|
148 | - [$this, 'getIsTrashed'] |
|
149 | - ), |
|
150 | - new GraphQLOutputField( |
|
151 | - 'isUpcoming', |
|
152 | - 'Boolean', |
|
153 | - 'is_upcoming', |
|
154 | - esc_html__('Whether the date is upcoming', 'event_espresso') |
|
155 | - ), |
|
156 | - new GraphQLOutputField( |
|
157 | - 'length', |
|
158 | - 'Int', |
|
159 | - 'length', |
|
160 | - esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
161 | - ), |
|
162 | - new GraphQLField( |
|
163 | - 'name', |
|
164 | - 'String', |
|
165 | - 'name', |
|
166 | - esc_html__('Datetime Name', 'event_espresso') |
|
167 | - ), |
|
168 | - new GraphQLField( |
|
169 | - 'order', |
|
170 | - 'Int', |
|
171 | - 'order', |
|
172 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
173 | - ), |
|
174 | - new GraphQLOutputField( |
|
175 | - 'parent', |
|
176 | - $this->name(), |
|
177 | - null, |
|
178 | - esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
179 | - ), |
|
180 | - new GraphQLInputField( |
|
181 | - 'parent', |
|
182 | - 'ID', |
|
183 | - null, |
|
184 | - esc_html__('The parent datetime ID', 'event_espresso') |
|
185 | - ), |
|
186 | - new GraphQLField( |
|
187 | - 'reserved', |
|
188 | - 'Int', |
|
189 | - 'reserved', |
|
190 | - esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
191 | - ), |
|
192 | - new GraphQLField( |
|
193 | - 'startDate', |
|
194 | - 'String', |
|
195 | - 'start_date_and_time', |
|
196 | - esc_html__('Start date and time of the Event', 'event_espresso'), |
|
197 | - [$this, 'formatDatetime'] |
|
198 | - ), |
|
199 | - new GraphQLField( |
|
200 | - 'sold', |
|
201 | - 'Int', |
|
202 | - 'sold', |
|
203 | - esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
204 | - ), |
|
205 | - new GraphQLOutputField( |
|
206 | - 'status', |
|
207 | - $this->namespace . 'DatetimeStatusEnum', |
|
208 | - 'get_active_status', |
|
209 | - esc_html__('Datetime status', 'event_espresso') |
|
210 | - ), |
|
211 | - new GraphQLInputField( |
|
212 | - 'tickets', |
|
213 | - ['list_of' => 'ID'], |
|
214 | - null, |
|
215 | - sprintf( |
|
216 | - '%1$s %2$s', |
|
217 | - esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'), |
|
218 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
219 | - ) |
|
220 | - ), |
|
221 | - ]; |
|
53 | + /** |
|
54 | + * @return GraphQLFieldInterface[] |
|
55 | + */ |
|
56 | + public function getFields(): array |
|
57 | + { |
|
58 | + $fields = [ |
|
59 | + new GraphQLField( |
|
60 | + 'id', |
|
61 | + ['non_null' => 'ID'], |
|
62 | + null, |
|
63 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
64 | + ), |
|
65 | + new GraphQLOutputField( |
|
66 | + 'dbId', |
|
67 | + ['non_null' => 'Int'], |
|
68 | + 'ID', |
|
69 | + esc_html__('The datetime ID.', 'event_espresso') |
|
70 | + ), |
|
71 | + new GraphQLOutputField( |
|
72 | + 'cacheId', |
|
73 | + ['non_null' => 'String'], |
|
74 | + null, |
|
75 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
76 | + ), |
|
77 | + new GraphQLField( |
|
78 | + 'capacity', |
|
79 | + 'Int', |
|
80 | + 'reg_limit', |
|
81 | + esc_html__('Registration Limit for this time', 'event_espresso'), |
|
82 | + [$this, 'parseInfiniteValue'] |
|
83 | + ), |
|
84 | + new GraphQLField( |
|
85 | + 'description', |
|
86 | + 'String', |
|
87 | + 'description', |
|
88 | + esc_html__('Description for Datetime', 'event_espresso') |
|
89 | + ), |
|
90 | + new GraphQLField( |
|
91 | + 'endDate', |
|
92 | + 'String', |
|
93 | + 'end_date_and_time', |
|
94 | + esc_html__('End date and time of the Event', 'event_espresso'), |
|
95 | + [$this, 'formatDatetime'] |
|
96 | + ), |
|
97 | + new GraphQLOutputField( |
|
98 | + 'event', |
|
99 | + $this->namespace . 'Event', |
|
100 | + null, |
|
101 | + esc_html__('Event of the datetime.', 'event_espresso') |
|
102 | + ), |
|
103 | + new GraphQLInputField( |
|
104 | + 'event', |
|
105 | + 'ID', |
|
106 | + null, |
|
107 | + esc_html__('Globally unique event ID of the datetime.', 'event_espresso') |
|
108 | + ), |
|
109 | + new GraphQLInputField( |
|
110 | + 'eventId', |
|
111 | + 'Int', |
|
112 | + null, |
|
113 | + esc_html__('Event ID of the datetime.', 'event_espresso') |
|
114 | + ), |
|
115 | + new GraphQLOutputField( |
|
116 | + 'isActive', |
|
117 | + 'Boolean', |
|
118 | + 'is_active', |
|
119 | + esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
120 | + ), |
|
121 | + new GraphQLOutputField( |
|
122 | + 'isExpired', |
|
123 | + 'Boolean', |
|
124 | + 'is_expired', |
|
125 | + esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
126 | + ), |
|
127 | + new GraphQLField( |
|
128 | + 'isPrimary', |
|
129 | + 'Boolean', |
|
130 | + 'is_primary', |
|
131 | + esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
132 | + ), |
|
133 | + new GraphQLOutputField( |
|
134 | + 'isSoldOut', |
|
135 | + 'Boolean', |
|
136 | + 'sold_out', |
|
137 | + esc_html__( |
|
138 | + 'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
139 | + 'event_espresso' |
|
140 | + ) |
|
141 | + ), |
|
142 | + new GraphQLField( |
|
143 | + 'isTrashed', |
|
144 | + 'Boolean', |
|
145 | + null, |
|
146 | + esc_html__('Flag indicating datetime has been trashed.', 'event_espresso'), |
|
147 | + null, |
|
148 | + [$this, 'getIsTrashed'] |
|
149 | + ), |
|
150 | + new GraphQLOutputField( |
|
151 | + 'isUpcoming', |
|
152 | + 'Boolean', |
|
153 | + 'is_upcoming', |
|
154 | + esc_html__('Whether the date is upcoming', 'event_espresso') |
|
155 | + ), |
|
156 | + new GraphQLOutputField( |
|
157 | + 'length', |
|
158 | + 'Int', |
|
159 | + 'length', |
|
160 | + esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
161 | + ), |
|
162 | + new GraphQLField( |
|
163 | + 'name', |
|
164 | + 'String', |
|
165 | + 'name', |
|
166 | + esc_html__('Datetime Name', 'event_espresso') |
|
167 | + ), |
|
168 | + new GraphQLField( |
|
169 | + 'order', |
|
170 | + 'Int', |
|
171 | + 'order', |
|
172 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
173 | + ), |
|
174 | + new GraphQLOutputField( |
|
175 | + 'parent', |
|
176 | + $this->name(), |
|
177 | + null, |
|
178 | + esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
179 | + ), |
|
180 | + new GraphQLInputField( |
|
181 | + 'parent', |
|
182 | + 'ID', |
|
183 | + null, |
|
184 | + esc_html__('The parent datetime ID', 'event_espresso') |
|
185 | + ), |
|
186 | + new GraphQLField( |
|
187 | + 'reserved', |
|
188 | + 'Int', |
|
189 | + 'reserved', |
|
190 | + esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
191 | + ), |
|
192 | + new GraphQLField( |
|
193 | + 'startDate', |
|
194 | + 'String', |
|
195 | + 'start_date_and_time', |
|
196 | + esc_html__('Start date and time of the Event', 'event_espresso'), |
|
197 | + [$this, 'formatDatetime'] |
|
198 | + ), |
|
199 | + new GraphQLField( |
|
200 | + 'sold', |
|
201 | + 'Int', |
|
202 | + 'sold', |
|
203 | + esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
204 | + ), |
|
205 | + new GraphQLOutputField( |
|
206 | + 'status', |
|
207 | + $this->namespace . 'DatetimeStatusEnum', |
|
208 | + 'get_active_status', |
|
209 | + esc_html__('Datetime status', 'event_espresso') |
|
210 | + ), |
|
211 | + new GraphQLInputField( |
|
212 | + 'tickets', |
|
213 | + ['list_of' => 'ID'], |
|
214 | + null, |
|
215 | + sprintf( |
|
216 | + '%1$s %2$s', |
|
217 | + esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'), |
|
218 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
219 | + ) |
|
220 | + ), |
|
221 | + ]; |
|
222 | 222 | |
223 | - return apply_filters( |
|
224 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__datetime_fields', |
|
225 | - $fields, |
|
226 | - $this->name, |
|
227 | - $this->model |
|
228 | - ); |
|
229 | - } |
|
223 | + return apply_filters( |
|
224 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__datetime_fields', |
|
225 | + $fields, |
|
226 | + $this->name, |
|
227 | + $this->model |
|
228 | + ); |
|
229 | + } |
|
230 | 230 | |
231 | 231 | |
232 | - /** |
|
233 | - * @param EE_Datetime $source The source that's passed down the GraphQL queries |
|
234 | - * @param array $args The inputArgs on the field |
|
235 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
236 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
237 | - * @return bool |
|
238 | - * @throws Exception |
|
239 | - * @throws InvalidArgumentException |
|
240 | - * @throws InvalidDataTypeException |
|
241 | - * @throws InvalidInterfaceException |
|
242 | - * @throws ReflectionException |
|
243 | - * @throws UserError |
|
244 | - * @throws UnexpectedEntityException |
|
245 | - */ |
|
246 | - public function getIsTrashed(EE_Datetime $source, array $args, AppContext $context, ResolveInfo $info): bool |
|
247 | - { |
|
248 | - return (bool) $source->get('DTT_deleted'); |
|
249 | - } |
|
232 | + /** |
|
233 | + * @param EE_Datetime $source The source that's passed down the GraphQL queries |
|
234 | + * @param array $args The inputArgs on the field |
|
235 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
236 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
237 | + * @return bool |
|
238 | + * @throws Exception |
|
239 | + * @throws InvalidArgumentException |
|
240 | + * @throws InvalidDataTypeException |
|
241 | + * @throws InvalidInterfaceException |
|
242 | + * @throws ReflectionException |
|
243 | + * @throws UserError |
|
244 | + * @throws UnexpectedEntityException |
|
245 | + */ |
|
246 | + public function getIsTrashed(EE_Datetime $source, array $args, AppContext $context, ResolveInfo $info): bool |
|
247 | + { |
|
248 | + return (bool) $source->get('DTT_deleted'); |
|
249 | + } |
|
250 | 250 | |
251 | - /** |
|
252 | - * Return the base mutation config for bulk update. |
|
253 | - * |
|
254 | - * @param string $base_input |
|
255 | - * @return array |
|
256 | - */ |
|
257 | - public static function bulkUpdateBaseConfig(string $base_input): array |
|
258 | - { |
|
259 | - return [ |
|
260 | - 'inputFields' => [ |
|
261 | - /** |
|
262 | - * represents the input that is unique for each entity |
|
263 | - * e.g. dates may be unique for datetimes and tickets |
|
264 | - */ |
|
265 | - 'uniqueInputs' => [ |
|
266 | - 'type' => [ |
|
267 | - 'non_null' => ['list_of' => $base_input], |
|
268 | - ], |
|
269 | - 'description' => esc_html__( |
|
270 | - 'List of unique inputs for each entity in bulk update', |
|
271 | - 'event_espresso' |
|
272 | - ), |
|
273 | - ], |
|
274 | - /** |
|
275 | - * represents the common input for all entities |
|
276 | - * e.g. capacity or quantity may be same for all dates/tickets |
|
277 | - */ |
|
278 | - 'sharedInput' => [ |
|
279 | - 'type' => $base_input, |
|
280 | - 'description' => esc_html__( |
|
281 | - 'Shared input for all entities in bulk update', |
|
282 | - 'event_espresso' |
|
283 | - ), |
|
284 | - ], |
|
285 | - ], |
|
286 | - 'outputFields' => [ |
|
287 | - 'updated' => [ |
|
288 | - 'type' => ['list_of' => 'ID'], |
|
289 | - ], |
|
290 | - 'failed' => [ |
|
291 | - 'type' => ['list_of' => 'ID'], |
|
292 | - ], |
|
293 | - ], |
|
294 | - ]; |
|
295 | - } |
|
251 | + /** |
|
252 | + * Return the base mutation config for bulk update. |
|
253 | + * |
|
254 | + * @param string $base_input |
|
255 | + * @return array |
|
256 | + */ |
|
257 | + public static function bulkUpdateBaseConfig(string $base_input): array |
|
258 | + { |
|
259 | + return [ |
|
260 | + 'inputFields' => [ |
|
261 | + /** |
|
262 | + * represents the input that is unique for each entity |
|
263 | + * e.g. dates may be unique for datetimes and tickets |
|
264 | + */ |
|
265 | + 'uniqueInputs' => [ |
|
266 | + 'type' => [ |
|
267 | + 'non_null' => ['list_of' => $base_input], |
|
268 | + ], |
|
269 | + 'description' => esc_html__( |
|
270 | + 'List of unique inputs for each entity in bulk update', |
|
271 | + 'event_espresso' |
|
272 | + ), |
|
273 | + ], |
|
274 | + /** |
|
275 | + * represents the common input for all entities |
|
276 | + * e.g. capacity or quantity may be same for all dates/tickets |
|
277 | + */ |
|
278 | + 'sharedInput' => [ |
|
279 | + 'type' => $base_input, |
|
280 | + 'description' => esc_html__( |
|
281 | + 'Shared input for all entities in bulk update', |
|
282 | + 'event_espresso' |
|
283 | + ), |
|
284 | + ], |
|
285 | + ], |
|
286 | + 'outputFields' => [ |
|
287 | + 'updated' => [ |
|
288 | + 'type' => ['list_of' => 'ID'], |
|
289 | + ], |
|
290 | + 'failed' => [ |
|
291 | + 'type' => ['list_of' => 'ID'], |
|
292 | + ], |
|
293 | + ], |
|
294 | + ]; |
|
295 | + } |
|
296 | 296 | |
297 | 297 | |
298 | - /** |
|
299 | - * @param array $inputFields The mutation input fields. |
|
300 | - * @throws InvalidArgumentException |
|
301 | - * @throws ReflectionException |
|
302 | - * @throws Exception |
|
303 | - */ |
|
304 | - public function registerMutations(array $inputFields) |
|
305 | - { |
|
306 | - register_graphql_input_type( |
|
307 | - 'Update' . $this->name() . 'BaseInput', |
|
308 | - [ |
|
309 | - 'fields' => $inputFields, |
|
310 | - ] |
|
311 | - ); |
|
312 | - // Register mutation to update an entity. |
|
313 | - register_graphql_mutation( |
|
314 | - 'update' . $this->name(), |
|
315 | - [ |
|
316 | - 'inputFields' => $inputFields, |
|
317 | - 'outputFields' => [ |
|
318 | - lcfirst($this->name()) => [ |
|
319 | - 'type' => $this->name(), |
|
320 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
321 | - ], |
|
322 | - ], |
|
323 | - 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
|
324 | - ] |
|
325 | - ); |
|
326 | - $base_input = 'Update' . $this->name() . 'BaseInput'; |
|
327 | - // Register mutation to update an entity. |
|
328 | - register_graphql_mutation( |
|
329 | - 'bulkUpdate' . $this->name(), |
|
330 | - array_merge( |
|
331 | - Datetime::bulkUpdateBaseConfig($base_input), |
|
332 | - [ |
|
333 | - 'mutateAndGetPayload' => DatetimeBulkUpdate::mutateAndGetPayload($this->model, $this), |
|
334 | - ] |
|
335 | - ) |
|
336 | - ); |
|
298 | + /** |
|
299 | + * @param array $inputFields The mutation input fields. |
|
300 | + * @throws InvalidArgumentException |
|
301 | + * @throws ReflectionException |
|
302 | + * @throws Exception |
|
303 | + */ |
|
304 | + public function registerMutations(array $inputFields) |
|
305 | + { |
|
306 | + register_graphql_input_type( |
|
307 | + 'Update' . $this->name() . 'BaseInput', |
|
308 | + [ |
|
309 | + 'fields' => $inputFields, |
|
310 | + ] |
|
311 | + ); |
|
312 | + // Register mutation to update an entity. |
|
313 | + register_graphql_mutation( |
|
314 | + 'update' . $this->name(), |
|
315 | + [ |
|
316 | + 'inputFields' => $inputFields, |
|
317 | + 'outputFields' => [ |
|
318 | + lcfirst($this->name()) => [ |
|
319 | + 'type' => $this->name(), |
|
320 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
321 | + ], |
|
322 | + ], |
|
323 | + 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
|
324 | + ] |
|
325 | + ); |
|
326 | + $base_input = 'Update' . $this->name() . 'BaseInput'; |
|
327 | + // Register mutation to update an entity. |
|
328 | + register_graphql_mutation( |
|
329 | + 'bulkUpdate' . $this->name(), |
|
330 | + array_merge( |
|
331 | + Datetime::bulkUpdateBaseConfig($base_input), |
|
332 | + [ |
|
333 | + 'mutateAndGetPayload' => DatetimeBulkUpdate::mutateAndGetPayload($this->model, $this), |
|
334 | + ] |
|
335 | + ) |
|
336 | + ); |
|
337 | 337 | |
338 | - // Register mutation to update an entity. |
|
339 | - register_graphql_mutation( |
|
340 | - 'bulkDelete' . $this->namespace . 'Entities', |
|
341 | - [ |
|
342 | - 'inputFields' => [ |
|
343 | - 'entityIds' => [ |
|
344 | - 'type' => [ |
|
345 | - 'non_null' => ['list_of' => 'ID'], |
|
346 | - ], |
|
347 | - 'description' => esc_html__('The list of GUIDs of the entities to be deleted.', 'event_espresso'), |
|
348 | - ], |
|
349 | - 'entityType' => [ |
|
350 | - 'type' => [ |
|
351 | - 'non_null' => $this->namespace . 'ModelNameEnum', |
|
352 | - ], |
|
353 | - 'description' => esc_html__('The entity type for the IDs', 'event_espresso'), |
|
354 | - ], |
|
355 | - 'deletePermanently' => [ |
|
356 | - 'type' => 'Boolean', |
|
357 | - 'description' => esc_html__('Whether to delete the entities permanently.', 'event_espresso'), |
|
358 | - ], |
|
359 | - ], |
|
360 | - 'outputFields' => [ |
|
361 | - 'deleted' => [ |
|
362 | - 'type' => ['list_of' => 'ID'], |
|
363 | - ], |
|
364 | - 'failed' => [ |
|
365 | - 'type' => ['list_of' => 'ID'], |
|
366 | - ], |
|
367 | - ], |
|
368 | - 'mutateAndGetPayload' => BulkEntityDelete::mutateAndGetPayload(), |
|
369 | - ] |
|
370 | - ); |
|
371 | - // Register mutation to delete an entity. |
|
372 | - register_graphql_mutation( |
|
373 | - 'delete' . $this->name(), |
|
374 | - [ |
|
375 | - 'inputFields' => [ |
|
376 | - 'id' => $inputFields['id'], |
|
377 | - 'deletePermanently' => [ |
|
378 | - 'type' => 'Boolean', |
|
379 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
380 | - ], |
|
381 | - ], |
|
382 | - 'outputFields' => [ |
|
383 | - lcfirst($this->name()) => [ |
|
384 | - 'type' => $this->name(), |
|
385 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
386 | - 'resolve' => static function ($payload) { |
|
387 | - $deleted = (object) $payload['deleted']; |
|
338 | + // Register mutation to update an entity. |
|
339 | + register_graphql_mutation( |
|
340 | + 'bulkDelete' . $this->namespace . 'Entities', |
|
341 | + [ |
|
342 | + 'inputFields' => [ |
|
343 | + 'entityIds' => [ |
|
344 | + 'type' => [ |
|
345 | + 'non_null' => ['list_of' => 'ID'], |
|
346 | + ], |
|
347 | + 'description' => esc_html__('The list of GUIDs of the entities to be deleted.', 'event_espresso'), |
|
348 | + ], |
|
349 | + 'entityType' => [ |
|
350 | + 'type' => [ |
|
351 | + 'non_null' => $this->namespace . 'ModelNameEnum', |
|
352 | + ], |
|
353 | + 'description' => esc_html__('The entity type for the IDs', 'event_espresso'), |
|
354 | + ], |
|
355 | + 'deletePermanently' => [ |
|
356 | + 'type' => 'Boolean', |
|
357 | + 'description' => esc_html__('Whether to delete the entities permanently.', 'event_espresso'), |
|
358 | + ], |
|
359 | + ], |
|
360 | + 'outputFields' => [ |
|
361 | + 'deleted' => [ |
|
362 | + 'type' => ['list_of' => 'ID'], |
|
363 | + ], |
|
364 | + 'failed' => [ |
|
365 | + 'type' => ['list_of' => 'ID'], |
|
366 | + ], |
|
367 | + ], |
|
368 | + 'mutateAndGetPayload' => BulkEntityDelete::mutateAndGetPayload(), |
|
369 | + ] |
|
370 | + ); |
|
371 | + // Register mutation to delete an entity. |
|
372 | + register_graphql_mutation( |
|
373 | + 'delete' . $this->name(), |
|
374 | + [ |
|
375 | + 'inputFields' => [ |
|
376 | + 'id' => $inputFields['id'], |
|
377 | + 'deletePermanently' => [ |
|
378 | + 'type' => 'Boolean', |
|
379 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
380 | + ], |
|
381 | + ], |
|
382 | + 'outputFields' => [ |
|
383 | + lcfirst($this->name()) => [ |
|
384 | + 'type' => $this->name(), |
|
385 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
386 | + 'resolve' => static function ($payload) { |
|
387 | + $deleted = (object) $payload['deleted']; |
|
388 | 388 | |
389 | - return ! empty($deleted) ? $deleted : null; |
|
390 | - }, |
|
391 | - ], |
|
392 | - ], |
|
393 | - 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
|
394 | - ] |
|
395 | - ); |
|
389 | + return ! empty($deleted) ? $deleted : null; |
|
390 | + }, |
|
391 | + ], |
|
392 | + ], |
|
393 | + 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
|
394 | + ] |
|
395 | + ); |
|
396 | 396 | |
397 | - // remove primary key from input. |
|
398 | - unset($inputFields['id']); |
|
399 | - // Register mutation to update an entity. |
|
400 | - register_graphql_mutation( |
|
401 | - 'create' . $this->name(), |
|
402 | - [ |
|
403 | - 'inputFields' => $inputFields, |
|
404 | - 'outputFields' => [ |
|
405 | - lcfirst($this->name()) => [ |
|
406 | - 'type' => $this->name(), |
|
407 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
408 | - ], |
|
409 | - ], |
|
410 | - 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
|
411 | - ] |
|
412 | - ); |
|
397 | + // remove primary key from input. |
|
398 | + unset($inputFields['id']); |
|
399 | + // Register mutation to update an entity. |
|
400 | + register_graphql_mutation( |
|
401 | + 'create' . $this->name(), |
|
402 | + [ |
|
403 | + 'inputFields' => $inputFields, |
|
404 | + 'outputFields' => [ |
|
405 | + lcfirst($this->name()) => [ |
|
406 | + 'type' => $this->name(), |
|
407 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
408 | + ], |
|
409 | + ], |
|
410 | + 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
|
411 | + ] |
|
412 | + ); |
|
413 | 413 | |
414 | - // Register mutation to update an entity. |
|
415 | - register_graphql_mutation( |
|
416 | - 'reorder' . $this->namespace . 'Entities', |
|
417 | - [ |
|
418 | - 'inputFields' => [ |
|
419 | - 'entityIds' => [ |
|
420 | - 'type' => [ |
|
421 | - 'non_null' => ['list_of' => 'ID'], |
|
422 | - ], |
|
423 | - 'description' => esc_html__('The reordered list of entity GUIDs.', 'event_espresso'), |
|
424 | - ], |
|
425 | - 'entityType' => [ |
|
426 | - 'type' => [ |
|
427 | - 'non_null' => $this->namespace . 'ModelNameEnum', |
|
428 | - ], |
|
429 | - 'description' => esc_html__('The entity type for the IDs', 'event_espresso'), |
|
430 | - ], |
|
431 | - ], |
|
432 | - 'outputFields' => [ |
|
433 | - 'ok' => [ |
|
434 | - 'type' => 'Boolean', |
|
435 | - 'resolve' => function ($payload) { |
|
436 | - return (bool) $payload['ok']; |
|
437 | - }, |
|
438 | - ], |
|
439 | - ], |
|
440 | - 'mutateAndGetPayload' => EntityReorder::mutateAndGetPayload(), |
|
441 | - ] |
|
442 | - ); |
|
443 | - } |
|
414 | + // Register mutation to update an entity. |
|
415 | + register_graphql_mutation( |
|
416 | + 'reorder' . $this->namespace . 'Entities', |
|
417 | + [ |
|
418 | + 'inputFields' => [ |
|
419 | + 'entityIds' => [ |
|
420 | + 'type' => [ |
|
421 | + 'non_null' => ['list_of' => 'ID'], |
|
422 | + ], |
|
423 | + 'description' => esc_html__('The reordered list of entity GUIDs.', 'event_espresso'), |
|
424 | + ], |
|
425 | + 'entityType' => [ |
|
426 | + 'type' => [ |
|
427 | + 'non_null' => $this->namespace . 'ModelNameEnum', |
|
428 | + ], |
|
429 | + 'description' => esc_html__('The entity type for the IDs', 'event_espresso'), |
|
430 | + ], |
|
431 | + ], |
|
432 | + 'outputFields' => [ |
|
433 | + 'ok' => [ |
|
434 | + 'type' => 'Boolean', |
|
435 | + 'resolve' => function ($payload) { |
|
436 | + return (bool) $payload['ok']; |
|
437 | + }, |
|
438 | + ], |
|
439 | + ], |
|
440 | + 'mutateAndGetPayload' => EntityReorder::mutateAndGetPayload(), |
|
441 | + ] |
|
442 | + ); |
|
443 | + } |
|
444 | 444 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct(EEM_Datetime $datetime_model) |
45 | 45 | { |
46 | - $this->setName($this->namespace . 'Datetime'); |
|
46 | + $this->setName($this->namespace.'Datetime'); |
|
47 | 47 | $this->setDescription(__('An event date', 'event_espresso')); |
48 | 48 | $this->setIsCustomPostType(false); |
49 | 49 | parent::__construct($datetime_model); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | ), |
97 | 97 | new GraphQLOutputField( |
98 | 98 | 'event', |
99 | - $this->namespace . 'Event', |
|
99 | + $this->namespace.'Event', |
|
100 | 100 | null, |
101 | 101 | esc_html__('Event of the datetime.', 'event_espresso') |
102 | 102 | ), |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | ), |
205 | 205 | new GraphQLOutputField( |
206 | 206 | 'status', |
207 | - $this->namespace . 'DatetimeStatusEnum', |
|
207 | + $this->namespace.'DatetimeStatusEnum', |
|
208 | 208 | 'get_active_status', |
209 | 209 | esc_html__('Datetime status', 'event_espresso') |
210 | 210 | ), |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | public function registerMutations(array $inputFields) |
305 | 305 | { |
306 | 306 | register_graphql_input_type( |
307 | - 'Update' . $this->name() . 'BaseInput', |
|
307 | + 'Update'.$this->name().'BaseInput', |
|
308 | 308 | [ |
309 | 309 | 'fields' => $inputFields, |
310 | 310 | ] |
311 | 311 | ); |
312 | 312 | // Register mutation to update an entity. |
313 | 313 | register_graphql_mutation( |
314 | - 'update' . $this->name(), |
|
314 | + 'update'.$this->name(), |
|
315 | 315 | [ |
316 | 316 | 'inputFields' => $inputFields, |
317 | 317 | 'outputFields' => [ |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
324 | 324 | ] |
325 | 325 | ); |
326 | - $base_input = 'Update' . $this->name() . 'BaseInput'; |
|
326 | + $base_input = 'Update'.$this->name().'BaseInput'; |
|
327 | 327 | // Register mutation to update an entity. |
328 | 328 | register_graphql_mutation( |
329 | - 'bulkUpdate' . $this->name(), |
|
329 | + 'bulkUpdate'.$this->name(), |
|
330 | 330 | array_merge( |
331 | 331 | Datetime::bulkUpdateBaseConfig($base_input), |
332 | 332 | [ |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | // Register mutation to update an entity. |
339 | 339 | register_graphql_mutation( |
340 | - 'bulkDelete' . $this->namespace . 'Entities', |
|
340 | + 'bulkDelete'.$this->namespace.'Entities', |
|
341 | 341 | [ |
342 | 342 | 'inputFields' => [ |
343 | 343 | 'entityIds' => [ |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | ], |
349 | 349 | 'entityType' => [ |
350 | 350 | 'type' => [ |
351 | - 'non_null' => $this->namespace . 'ModelNameEnum', |
|
351 | + 'non_null' => $this->namespace.'ModelNameEnum', |
|
352 | 352 | ], |
353 | 353 | 'description' => esc_html__('The entity type for the IDs', 'event_espresso'), |
354 | 354 | ], |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | ); |
371 | 371 | // Register mutation to delete an entity. |
372 | 372 | register_graphql_mutation( |
373 | - 'delete' . $this->name(), |
|
373 | + 'delete'.$this->name(), |
|
374 | 374 | [ |
375 | 375 | 'inputFields' => [ |
376 | 376 | 'id' => $inputFields['id'], |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | lcfirst($this->name()) => [ |
384 | 384 | 'type' => $this->name(), |
385 | 385 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
386 | - 'resolve' => static function ($payload) { |
|
386 | + 'resolve' => static function($payload) { |
|
387 | 387 | $deleted = (object) $payload['deleted']; |
388 | 388 | |
389 | 389 | return ! empty($deleted) ? $deleted : null; |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | unset($inputFields['id']); |
399 | 399 | // Register mutation to update an entity. |
400 | 400 | register_graphql_mutation( |
401 | - 'create' . $this->name(), |
|
401 | + 'create'.$this->name(), |
|
402 | 402 | [ |
403 | 403 | 'inputFields' => $inputFields, |
404 | 404 | 'outputFields' => [ |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | // Register mutation to update an entity. |
415 | 415 | register_graphql_mutation( |
416 | - 'reorder' . $this->namespace . 'Entities', |
|
416 | + 'reorder'.$this->namespace.'Entities', |
|
417 | 417 | [ |
418 | 418 | 'inputFields' => [ |
419 | 419 | 'entityIds' => [ |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | ], |
425 | 425 | 'entityType' => [ |
426 | 426 | 'type' => [ |
427 | - 'non_null' => $this->namespace . 'ModelNameEnum', |
|
427 | + 'non_null' => $this->namespace.'ModelNameEnum', |
|
428 | 428 | ], |
429 | 429 | 'description' => esc_html__('The entity type for the IDs', 'event_espresso'), |
430 | 430 | ], |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | 'outputFields' => [ |
433 | 433 | 'ok' => [ |
434 | 434 | 'type' => 'Boolean', |
435 | - 'resolve' => function ($payload) { |
|
435 | + 'resolve' => function($payload) { |
|
436 | 436 | return (bool) $payload['ok']; |
437 | 437 | }, |
438 | 438 | ], |
@@ -27,72 +27,72 @@ |
||
27 | 27 | class RootQuery extends TypeBase |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * RootQuery constructor. |
|
32 | - */ |
|
33 | - public function __construct() |
|
34 | - { |
|
35 | - $this->setName('RootQuery'); |
|
36 | - $this->setIsCustomPostType(true); |
|
37 | - parent::__construct(); |
|
38 | - } |
|
30 | + /** |
|
31 | + * RootQuery constructor. |
|
32 | + */ |
|
33 | + public function __construct() |
|
34 | + { |
|
35 | + $this->setName('RootQuery'); |
|
36 | + $this->setIsCustomPostType(true); |
|
37 | + parent::__construct(); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @return GraphQLFieldInterface[] |
|
43 | - */ |
|
44 | - public function getFields(): array |
|
45 | - { |
|
46 | - return [ |
|
47 | - new GraphQLOutputField( |
|
48 | - lcfirst($this->namespace) . 'EventRelations', |
|
49 | - 'String', |
|
50 | - null, |
|
51 | - esc_html__('JSON encoded relational data of the models', 'event_espresso'), |
|
52 | - null, |
|
53 | - [$this, 'getEventRelationalData'], |
|
54 | - [ |
|
55 | - 'eventId' => [ |
|
56 | - 'type' => ['non_null' => 'Int'], |
|
57 | - 'description' => esc_html__('The event ID to get the relational data for.', 'event_espresso'), |
|
58 | - ], |
|
59 | - ] |
|
60 | - ), |
|
61 | - ]; |
|
62 | - } |
|
41 | + /** |
|
42 | + * @return GraphQLFieldInterface[] |
|
43 | + */ |
|
44 | + public function getFields(): array |
|
45 | + { |
|
46 | + return [ |
|
47 | + new GraphQLOutputField( |
|
48 | + lcfirst($this->namespace) . 'EventRelations', |
|
49 | + 'String', |
|
50 | + null, |
|
51 | + esc_html__('JSON encoded relational data of the models', 'event_espresso'), |
|
52 | + null, |
|
53 | + [$this, 'getEventRelationalData'], |
|
54 | + [ |
|
55 | + 'eventId' => [ |
|
56 | + 'type' => ['non_null' => 'Int'], |
|
57 | + 'description' => esc_html__('The event ID to get the relational data for.', 'event_espresso'), |
|
58 | + ], |
|
59 | + ] |
|
60 | + ), |
|
61 | + ]; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * @param mixed $source The source that's passed down the GraphQL queries |
|
67 | - * @param array $args The inputArgs on the field |
|
68 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
69 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
70 | - * @return string |
|
71 | - * @throws Exception |
|
72 | - * @throws InvalidArgumentException |
|
73 | - * @throws InvalidDataTypeException |
|
74 | - * @throws InvalidInterfaceException |
|
75 | - * @throws UserError |
|
76 | - * @throws UnexpectedEntityException |
|
77 | - * @since $VID:$ |
|
78 | - */ |
|
79 | - public function getEventRelationalData($source, array $args, AppContext $context, ResolveInfo $info): string |
|
80 | - { |
|
81 | - /** |
|
82 | - * Throw an exception if there's no event ID |
|
83 | - */ |
|
84 | - if (empty($args['eventId']) || ! absint($args['eventId'])) { |
|
85 | - throw new UserError(esc_html__( |
|
86 | - 'No event ID was provided to get the relational data for', |
|
87 | - 'event_espresso' |
|
88 | - )); |
|
89 | - } |
|
65 | + /** |
|
66 | + * @param mixed $source The source that's passed down the GraphQL queries |
|
67 | + * @param array $args The inputArgs on the field |
|
68 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
69 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
70 | + * @return string |
|
71 | + * @throws Exception |
|
72 | + * @throws InvalidArgumentException |
|
73 | + * @throws InvalidDataTypeException |
|
74 | + * @throws InvalidInterfaceException |
|
75 | + * @throws UserError |
|
76 | + * @throws UnexpectedEntityException |
|
77 | + * @since $VID:$ |
|
78 | + */ |
|
79 | + public function getEventRelationalData($source, array $args, AppContext $context, ResolveInfo $info): string |
|
80 | + { |
|
81 | + /** |
|
82 | + * Throw an exception if there's no event ID |
|
83 | + */ |
|
84 | + if (empty($args['eventId']) || ! absint($args['eventId'])) { |
|
85 | + throw new UserError(esc_html__( |
|
86 | + 'No event ID was provided to get the relational data for', |
|
87 | + 'event_espresso' |
|
88 | + )); |
|
89 | + } |
|
90 | 90 | |
91 | - $eventId = absint($args['eventId']); |
|
92 | - /** @var EventEntityRelations $event_entity_relations */ |
|
93 | - $event_entity_relations = LoaderFactory::getLoader()->getShared( |
|
94 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' |
|
95 | - ); |
|
96 | - return json_encode($event_entity_relations->getData($eventId)); |
|
97 | - } |
|
91 | + $eventId = absint($args['eventId']); |
|
92 | + /** @var EventEntityRelations $event_entity_relations */ |
|
93 | + $event_entity_relations = LoaderFactory::getLoader()->getShared( |
|
94 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' |
|
95 | + ); |
|
96 | + return json_encode($event_entity_relations->getData($eventId)); |
|
97 | + } |
|
98 | 98 | } |
@@ -21,213 +21,213 @@ |
||
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->setName($this->namespace . 'Event'); |
|
32 | - $this->setIsCustomPostType(true); |
|
33 | - parent::__construct($event_model); |
|
34 | - } |
|
24 | + /** |
|
25 | + * Event constructor. |
|
26 | + * |
|
27 | + * @param EEM_Event $event_model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Event $event_model) |
|
30 | + { |
|
31 | + $this->setName($this->namespace . 'Event'); |
|
32 | + $this->setIsCustomPostType(true); |
|
33 | + parent::__construct($event_model); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return GraphQLFieldInterface[] |
|
39 | - */ |
|
40 | - public function getFields(): array |
|
41 | - { |
|
42 | - $fields = [ |
|
43 | - new GraphQLField( |
|
44 | - 'allowDonations', |
|
45 | - 'Boolean', |
|
46 | - 'donations', |
|
47 | - esc_html__('Accept Donations?', 'event_espresso') |
|
48 | - ), |
|
49 | - new GraphQLField( |
|
50 | - 'allowOverflow', |
|
51 | - 'Boolean', |
|
52 | - 'allow_overflow', |
|
53 | - esc_html__('Enable Wait List for Event', 'event_espresso') |
|
54 | - ), |
|
55 | - new GraphQLField( |
|
56 | - 'altRegPage', |
|
57 | - 'String', |
|
58 | - 'external_url', |
|
59 | - esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
60 | - ), |
|
61 | - new GraphQLOutputField( |
|
62 | - 'cacheId', |
|
63 | - ['non_null' => 'String'], |
|
64 | - null, |
|
65 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
66 | - ), |
|
67 | - new GraphQLField( |
|
68 | - 'created', |
|
69 | - 'String', |
|
70 | - 'created', |
|
71 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
72 | - ), |
|
73 | - new GraphQLOutputField( |
|
74 | - 'dbId', |
|
75 | - ['non_null' => 'Int'], |
|
76 | - 'ID', |
|
77 | - esc_html__('The event ID.', 'event_espresso') |
|
78 | - ), |
|
79 | - new GraphQLField( |
|
80 | - 'defaultRegStatus', |
|
81 | - $this->namespace . 'RegistrationStatusEnum', |
|
82 | - 'default_registration_status', |
|
83 | - esc_html__('Default Event Registration Status', 'event_espresso') |
|
84 | - ), |
|
85 | - new GraphQLField( |
|
86 | - 'description', |
|
87 | - 'String', |
|
88 | - 'description', |
|
89 | - esc_html__('Event Description', 'event_espresso') |
|
90 | - ), |
|
91 | - new GraphQLField( |
|
92 | - 'displayDescription', |
|
93 | - 'Boolean', |
|
94 | - 'display_description', |
|
95 | - esc_html__('Display Description Flag', 'event_espresso') |
|
96 | - ), |
|
97 | - new GraphQLField( |
|
98 | - 'displayTicketSelector', |
|
99 | - 'Boolean', |
|
100 | - 'display_ticket_selector', |
|
101 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
102 | - ), |
|
103 | - new GraphQLOutputField( |
|
104 | - 'isActive', |
|
105 | - 'Boolean', |
|
106 | - 'is_active', |
|
107 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
108 | - ), |
|
109 | - new GraphQLOutputField( |
|
110 | - 'isCancelled', |
|
111 | - 'Boolean', |
|
112 | - 'is_cancelled', |
|
113 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
114 | - ), |
|
115 | - new GraphQLOutputField( |
|
116 | - 'isExpired', |
|
117 | - 'Boolean', |
|
118 | - 'is_expired', |
|
119 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
120 | - ), |
|
121 | - new GraphQLOutputField( |
|
122 | - 'isInactive', |
|
123 | - 'Boolean', |
|
124 | - 'is_inactive', |
|
125 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
126 | - ), |
|
127 | - new GraphQLOutputField( |
|
128 | - 'isPostponed', |
|
129 | - 'Boolean', |
|
130 | - 'is_postponed', |
|
131 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
132 | - ), |
|
133 | - new GraphQLOutputField( |
|
134 | - 'isSoldOut', |
|
135 | - 'Boolean', |
|
136 | - 'is_sold_out', |
|
137 | - esc_html__( |
|
138 | - 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
139 | - 'event_espresso' |
|
140 | - ) |
|
141 | - ), |
|
142 | - new GraphQLOutputField( |
|
143 | - 'isUpcoming', |
|
144 | - 'Boolean', |
|
145 | - 'is_upcoming', |
|
146 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
147 | - ), |
|
148 | - new GraphQLInputField( |
|
149 | - 'manager', |
|
150 | - 'String', |
|
151 | - null, |
|
152 | - esc_html__('Globally unique event ID for the event manager', 'event_espresso') |
|
153 | - ), |
|
154 | - new GraphQLOutputField( |
|
155 | - 'manager', |
|
156 | - 'User', |
|
157 | - null, |
|
158 | - esc_html__('Event Manager', 'event_espresso') |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'maxRegistrations', |
|
162 | - 'Int', |
|
163 | - 'additional_limit', |
|
164 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'memberOnly', |
|
168 | - 'Boolean', |
|
169 | - 'member_only', |
|
170 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
171 | - ), |
|
172 | - new GraphQLField( |
|
173 | - 'name', |
|
174 | - 'String', |
|
175 | - 'name', |
|
176 | - esc_html__('Event Name', 'event_espresso') |
|
177 | - ), |
|
178 | - new GraphQLField( |
|
179 | - 'order', |
|
180 | - 'Int', |
|
181 | - 'order', |
|
182 | - esc_html__('Event Menu Order', 'event_espresso') |
|
183 | - ), |
|
184 | - new GraphQLField( |
|
185 | - 'phoneNumber', |
|
186 | - 'String', |
|
187 | - 'phone', |
|
188 | - esc_html__('Event Phone Number', 'event_espresso') |
|
189 | - ), |
|
190 | - new GraphQLField( |
|
191 | - 'shortDescription', |
|
192 | - 'String', |
|
193 | - 'short_description', |
|
194 | - esc_html__('Event Short Description', 'event_espresso') |
|
195 | - ), |
|
196 | - new GraphQLField( |
|
197 | - 'timezoneString', |
|
198 | - 'String', |
|
199 | - 'timezone_string', |
|
200 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
201 | - ), |
|
202 | - new GraphQLField( |
|
203 | - 'visibleOn', |
|
204 | - 'String', |
|
205 | - 'visible_on', |
|
206 | - esc_html__('Event Visible Date', 'event_espresso') |
|
207 | - ), |
|
208 | - ]; |
|
37 | + /** |
|
38 | + * @return GraphQLFieldInterface[] |
|
39 | + */ |
|
40 | + public function getFields(): array |
|
41 | + { |
|
42 | + $fields = [ |
|
43 | + new GraphQLField( |
|
44 | + 'allowDonations', |
|
45 | + 'Boolean', |
|
46 | + 'donations', |
|
47 | + esc_html__('Accept Donations?', 'event_espresso') |
|
48 | + ), |
|
49 | + new GraphQLField( |
|
50 | + 'allowOverflow', |
|
51 | + 'Boolean', |
|
52 | + 'allow_overflow', |
|
53 | + esc_html__('Enable Wait List for Event', 'event_espresso') |
|
54 | + ), |
|
55 | + new GraphQLField( |
|
56 | + 'altRegPage', |
|
57 | + 'String', |
|
58 | + 'external_url', |
|
59 | + esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
60 | + ), |
|
61 | + new GraphQLOutputField( |
|
62 | + 'cacheId', |
|
63 | + ['non_null' => 'String'], |
|
64 | + null, |
|
65 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
66 | + ), |
|
67 | + new GraphQLField( |
|
68 | + 'created', |
|
69 | + 'String', |
|
70 | + 'created', |
|
71 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
72 | + ), |
|
73 | + new GraphQLOutputField( |
|
74 | + 'dbId', |
|
75 | + ['non_null' => 'Int'], |
|
76 | + 'ID', |
|
77 | + esc_html__('The event ID.', 'event_espresso') |
|
78 | + ), |
|
79 | + new GraphQLField( |
|
80 | + 'defaultRegStatus', |
|
81 | + $this->namespace . 'RegistrationStatusEnum', |
|
82 | + 'default_registration_status', |
|
83 | + esc_html__('Default Event Registration Status', 'event_espresso') |
|
84 | + ), |
|
85 | + new GraphQLField( |
|
86 | + 'description', |
|
87 | + 'String', |
|
88 | + 'description', |
|
89 | + esc_html__('Event Description', 'event_espresso') |
|
90 | + ), |
|
91 | + new GraphQLField( |
|
92 | + 'displayDescription', |
|
93 | + 'Boolean', |
|
94 | + 'display_description', |
|
95 | + esc_html__('Display Description Flag', 'event_espresso') |
|
96 | + ), |
|
97 | + new GraphQLField( |
|
98 | + 'displayTicketSelector', |
|
99 | + 'Boolean', |
|
100 | + 'display_ticket_selector', |
|
101 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
102 | + ), |
|
103 | + new GraphQLOutputField( |
|
104 | + 'isActive', |
|
105 | + 'Boolean', |
|
106 | + 'is_active', |
|
107 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
108 | + ), |
|
109 | + new GraphQLOutputField( |
|
110 | + 'isCancelled', |
|
111 | + 'Boolean', |
|
112 | + 'is_cancelled', |
|
113 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
114 | + ), |
|
115 | + new GraphQLOutputField( |
|
116 | + 'isExpired', |
|
117 | + 'Boolean', |
|
118 | + 'is_expired', |
|
119 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
120 | + ), |
|
121 | + new GraphQLOutputField( |
|
122 | + 'isInactive', |
|
123 | + 'Boolean', |
|
124 | + 'is_inactive', |
|
125 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
126 | + ), |
|
127 | + new GraphQLOutputField( |
|
128 | + 'isPostponed', |
|
129 | + 'Boolean', |
|
130 | + 'is_postponed', |
|
131 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
132 | + ), |
|
133 | + new GraphQLOutputField( |
|
134 | + 'isSoldOut', |
|
135 | + 'Boolean', |
|
136 | + 'is_sold_out', |
|
137 | + esc_html__( |
|
138 | + 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
139 | + 'event_espresso' |
|
140 | + ) |
|
141 | + ), |
|
142 | + new GraphQLOutputField( |
|
143 | + 'isUpcoming', |
|
144 | + 'Boolean', |
|
145 | + 'is_upcoming', |
|
146 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
147 | + ), |
|
148 | + new GraphQLInputField( |
|
149 | + 'manager', |
|
150 | + 'String', |
|
151 | + null, |
|
152 | + esc_html__('Globally unique event ID for the event manager', 'event_espresso') |
|
153 | + ), |
|
154 | + new GraphQLOutputField( |
|
155 | + 'manager', |
|
156 | + 'User', |
|
157 | + null, |
|
158 | + esc_html__('Event Manager', 'event_espresso') |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'maxRegistrations', |
|
162 | + 'Int', |
|
163 | + 'additional_limit', |
|
164 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'memberOnly', |
|
168 | + 'Boolean', |
|
169 | + 'member_only', |
|
170 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
171 | + ), |
|
172 | + new GraphQLField( |
|
173 | + 'name', |
|
174 | + 'String', |
|
175 | + 'name', |
|
176 | + esc_html__('Event Name', 'event_espresso') |
|
177 | + ), |
|
178 | + new GraphQLField( |
|
179 | + 'order', |
|
180 | + 'Int', |
|
181 | + 'order', |
|
182 | + esc_html__('Event Menu Order', 'event_espresso') |
|
183 | + ), |
|
184 | + new GraphQLField( |
|
185 | + 'phoneNumber', |
|
186 | + 'String', |
|
187 | + 'phone', |
|
188 | + esc_html__('Event Phone Number', 'event_espresso') |
|
189 | + ), |
|
190 | + new GraphQLField( |
|
191 | + 'shortDescription', |
|
192 | + 'String', |
|
193 | + 'short_description', |
|
194 | + esc_html__('Event Short Description', 'event_espresso') |
|
195 | + ), |
|
196 | + new GraphQLField( |
|
197 | + 'timezoneString', |
|
198 | + 'String', |
|
199 | + 'timezone_string', |
|
200 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
201 | + ), |
|
202 | + new GraphQLField( |
|
203 | + 'visibleOn', |
|
204 | + 'String', |
|
205 | + 'visible_on', |
|
206 | + esc_html__('Event Visible Date', 'event_espresso') |
|
207 | + ), |
|
208 | + ]; |
|
209 | 209 | |
210 | - return apply_filters( |
|
211 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
212 | - $fields, |
|
213 | - $this->name, |
|
214 | - $this->model |
|
215 | - ); |
|
216 | - } |
|
210 | + return apply_filters( |
|
211 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
212 | + $fields, |
|
213 | + $this->name, |
|
214 | + $this->model |
|
215 | + ); |
|
216 | + } |
|
217 | 217 | |
218 | 218 | |
219 | - /** |
|
220 | - * Extends the existing WP GraphQL mutations. |
|
221 | - * |
|
222 | - * @since $VID:$ |
|
223 | - */ |
|
224 | - public function extendMutations() |
|
225 | - { |
|
226 | - add_action( |
|
227 | - 'graphql_post_object_mutation_update_additional_data', |
|
228 | - EventUpdate::mutateFields($this->model, $this), |
|
229 | - 10, |
|
230 | - 6 |
|
231 | - ); |
|
232 | - } |
|
219 | + /** |
|
220 | + * Extends the existing WP GraphQL mutations. |
|
221 | + * |
|
222 | + * @since $VID:$ |
|
223 | + */ |
|
224 | + public function extendMutations() |
|
225 | + { |
|
226 | + add_action( |
|
227 | + 'graphql_post_object_mutation_update_additional_data', |
|
228 | + EventUpdate::mutateFields($this->model, $this), |
|
229 | + 10, |
|
230 | + 6 |
|
231 | + ); |
|
232 | + } |
|
233 | 233 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct(EEM_Event $event_model) |
30 | 30 | { |
31 | - $this->setName($this->namespace . 'Event'); |
|
31 | + $this->setName($this->namespace.'Event'); |
|
32 | 32 | $this->setIsCustomPostType(true); |
33 | 33 | parent::__construct($event_model); |
34 | 34 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ), |
79 | 79 | new GraphQLField( |
80 | 80 | 'defaultRegStatus', |
81 | - $this->namespace . 'RegistrationStatusEnum', |
|
81 | + $this->namespace.'RegistrationStatusEnum', |
|
82 | 82 | 'default_registration_status', |
83 | 83 | esc_html__('Default Event Registration Status', 'event_espresso') |
84 | 84 | ), |
@@ -20,117 +20,117 @@ |
||
20 | 20 | class PriceType extends TypeBase |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * PriceType constructor. |
|
25 | - * |
|
26 | - * @param EEM_Price_Type $price_type_model |
|
27 | - */ |
|
28 | - public function __construct(EEM_Price_Type $price_type_model) |
|
29 | - { |
|
30 | - $this->setName($this->namespace . 'PriceType'); |
|
31 | - $this->setDescription(__('A price type.', 'event_espresso')); |
|
32 | - $this->setIsCustomPostType(false); |
|
33 | - parent::__construct($price_type_model); |
|
34 | - } |
|
23 | + /** |
|
24 | + * PriceType constructor. |
|
25 | + * |
|
26 | + * @param EEM_Price_Type $price_type_model |
|
27 | + */ |
|
28 | + public function __construct(EEM_Price_Type $price_type_model) |
|
29 | + { |
|
30 | + $this->setName($this->namespace . 'PriceType'); |
|
31 | + $this->setDescription(__('A price type.', 'event_espresso')); |
|
32 | + $this->setIsCustomPostType(false); |
|
33 | + parent::__construct($price_type_model); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return GraphQLFieldInterface[] |
|
39 | - */ |
|
40 | - public function getFields(): array |
|
41 | - { |
|
42 | - $fields = [ |
|
43 | - new GraphQLField( |
|
44 | - 'id', |
|
45 | - ['non_null' => 'ID'], |
|
46 | - null, |
|
47 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
48 | - ), |
|
49 | - new GraphQLOutputField( |
|
50 | - 'dbId', |
|
51 | - ['non_null' => 'Int'], |
|
52 | - 'ID', |
|
53 | - esc_html__('Price type ID', 'event_espresso') |
|
54 | - ), |
|
55 | - new GraphQLField( |
|
56 | - 'baseType', |
|
57 | - $this->namespace . 'PriceBaseTypeEnum', |
|
58 | - 'base_type', |
|
59 | - esc_html__('Price Base type', 'event_espresso') |
|
60 | - ), |
|
61 | - new GraphQLOutputField( |
|
62 | - 'cacheId', |
|
63 | - ['non_null' => 'String'], |
|
64 | - null, |
|
65 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
66 | - ), |
|
67 | - new GraphQLField( |
|
68 | - 'isBasePrice', |
|
69 | - 'Boolean', |
|
70 | - 'is_base_price', |
|
71 | - esc_html__('Flag indicating price type is a base price.', 'event_espresso') |
|
72 | - ), |
|
73 | - new GraphQLField( |
|
74 | - 'isTrashed', |
|
75 | - 'Boolean', |
|
76 | - 'deleted', |
|
77 | - esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
78 | - ), |
|
79 | - new GraphQLOutputField( |
|
80 | - 'isDiscount', |
|
81 | - 'Boolean', |
|
82 | - 'is_discount', |
|
83 | - esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
84 | - ), |
|
85 | - new GraphQLField( |
|
86 | - 'isPercent', |
|
87 | - 'Boolean', |
|
88 | - 'is_percent', |
|
89 | - esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
90 | - ), |
|
91 | - new GraphQLOutputField( |
|
92 | - 'isTax', |
|
93 | - 'Boolean', |
|
94 | - 'is_tax', |
|
95 | - esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
96 | - ), |
|
97 | - new GraphQLField( |
|
98 | - 'name', |
|
99 | - 'String', |
|
100 | - 'name', |
|
101 | - esc_html__('Price type Name', 'event_espresso') |
|
102 | - ), |
|
103 | - new GraphQLField( |
|
104 | - 'order', |
|
105 | - 'Int', |
|
106 | - 'order', |
|
107 | - esc_html__('Order in which price should be applied.', 'event_espresso') |
|
108 | - ), |
|
109 | - new GraphQLOutputField( |
|
110 | - 'wpUser', |
|
111 | - 'User', |
|
112 | - null, |
|
113 | - esc_html__('Price Type Creator', 'event_espresso') |
|
114 | - ), |
|
115 | - new GraphQLOutputField( |
|
116 | - 'userId', |
|
117 | - 'ID', |
|
118 | - null, |
|
119 | - esc_html__('Price Type Creator ID', 'event_espresso') |
|
120 | - ), |
|
121 | - new GraphQLInputField( |
|
122 | - 'wpUser', |
|
123 | - 'Int', |
|
124 | - null, |
|
125 | - esc_html__('Price Type Creator ID', 'event_espresso') |
|
126 | - ), |
|
127 | - ]; |
|
37 | + /** |
|
38 | + * @return GraphQLFieldInterface[] |
|
39 | + */ |
|
40 | + public function getFields(): array |
|
41 | + { |
|
42 | + $fields = [ |
|
43 | + new GraphQLField( |
|
44 | + 'id', |
|
45 | + ['non_null' => 'ID'], |
|
46 | + null, |
|
47 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
48 | + ), |
|
49 | + new GraphQLOutputField( |
|
50 | + 'dbId', |
|
51 | + ['non_null' => 'Int'], |
|
52 | + 'ID', |
|
53 | + esc_html__('Price type ID', 'event_espresso') |
|
54 | + ), |
|
55 | + new GraphQLField( |
|
56 | + 'baseType', |
|
57 | + $this->namespace . 'PriceBaseTypeEnum', |
|
58 | + 'base_type', |
|
59 | + esc_html__('Price Base type', 'event_espresso') |
|
60 | + ), |
|
61 | + new GraphQLOutputField( |
|
62 | + 'cacheId', |
|
63 | + ['non_null' => 'String'], |
|
64 | + null, |
|
65 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
66 | + ), |
|
67 | + new GraphQLField( |
|
68 | + 'isBasePrice', |
|
69 | + 'Boolean', |
|
70 | + 'is_base_price', |
|
71 | + esc_html__('Flag indicating price type is a base price.', 'event_espresso') |
|
72 | + ), |
|
73 | + new GraphQLField( |
|
74 | + 'isTrashed', |
|
75 | + 'Boolean', |
|
76 | + 'deleted', |
|
77 | + esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
78 | + ), |
|
79 | + new GraphQLOutputField( |
|
80 | + 'isDiscount', |
|
81 | + 'Boolean', |
|
82 | + 'is_discount', |
|
83 | + esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
84 | + ), |
|
85 | + new GraphQLField( |
|
86 | + 'isPercent', |
|
87 | + 'Boolean', |
|
88 | + 'is_percent', |
|
89 | + esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
90 | + ), |
|
91 | + new GraphQLOutputField( |
|
92 | + 'isTax', |
|
93 | + 'Boolean', |
|
94 | + 'is_tax', |
|
95 | + esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
96 | + ), |
|
97 | + new GraphQLField( |
|
98 | + 'name', |
|
99 | + 'String', |
|
100 | + 'name', |
|
101 | + esc_html__('Price type Name', 'event_espresso') |
|
102 | + ), |
|
103 | + new GraphQLField( |
|
104 | + 'order', |
|
105 | + 'Int', |
|
106 | + 'order', |
|
107 | + esc_html__('Order in which price should be applied.', 'event_espresso') |
|
108 | + ), |
|
109 | + new GraphQLOutputField( |
|
110 | + 'wpUser', |
|
111 | + 'User', |
|
112 | + null, |
|
113 | + esc_html__('Price Type Creator', 'event_espresso') |
|
114 | + ), |
|
115 | + new GraphQLOutputField( |
|
116 | + 'userId', |
|
117 | + 'ID', |
|
118 | + null, |
|
119 | + esc_html__('Price Type Creator ID', 'event_espresso') |
|
120 | + ), |
|
121 | + new GraphQLInputField( |
|
122 | + 'wpUser', |
|
123 | + 'Int', |
|
124 | + null, |
|
125 | + esc_html__('Price Type Creator ID', 'event_espresso') |
|
126 | + ), |
|
127 | + ]; |
|
128 | 128 | |
129 | - return apply_filters( |
|
130 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__priceType_fields', |
|
131 | - $fields, |
|
132 | - $this->name, |
|
133 | - $this->model |
|
134 | - ); |
|
135 | - } |
|
129 | + return apply_filters( |
|
130 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__priceType_fields', |
|
131 | + $fields, |
|
132 | + $this->name, |
|
133 | + $this->model |
|
134 | + ); |
|
135 | + } |
|
136 | 136 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct(EEM_Price_Type $price_type_model) |
29 | 29 | { |
30 | - $this->setName($this->namespace . 'PriceType'); |
|
30 | + $this->setName($this->namespace.'PriceType'); |
|
31 | 31 | $this->setDescription(__('A price type.', 'event_espresso')); |
32 | 32 | $this->setIsCustomPostType(false); |
33 | 33 | parent::__construct($price_type_model); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | ), |
55 | 55 | new GraphQLField( |
56 | 56 | 'baseType', |
57 | - $this->namespace . 'PriceBaseTypeEnum', |
|
57 | + $this->namespace.'PriceBaseTypeEnum', |
|
58 | 58 | 'base_type', |
59 | 59 | esc_html__('Price Base type', 'event_espresso') |
60 | 60 | ), |
@@ -19,120 +19,120 @@ |
||
19 | 19 | class Country extends TypeBase |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * Country constructor. |
|
24 | - * |
|
25 | - * @param EEM_Country $country_model |
|
26 | - */ |
|
27 | - public function __construct(EEM_Country $country_model) |
|
28 | - { |
|
29 | - $this->setName($this->namespace . 'Country'); |
|
30 | - $this->setDescription(__('A country', 'event_espresso')); |
|
31 | - $this->setIsCustomPostType(false); |
|
32 | - parent::__construct($country_model); |
|
33 | - } |
|
22 | + /** |
|
23 | + * Country constructor. |
|
24 | + * |
|
25 | + * @param EEM_Country $country_model |
|
26 | + */ |
|
27 | + public function __construct(EEM_Country $country_model) |
|
28 | + { |
|
29 | + $this->setName($this->namespace . 'Country'); |
|
30 | + $this->setDescription(__('A country', 'event_espresso')); |
|
31 | + $this->setIsCustomPostType(false); |
|
32 | + parent::__construct($country_model); |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * @return GraphQLFieldInterface[] |
|
38 | - */ |
|
39 | - public function getFields(): array |
|
40 | - { |
|
41 | - $fields = [ |
|
42 | - new GraphQLField( |
|
43 | - 'id', |
|
44 | - ['non_null' => 'ID'], |
|
45 | - null, |
|
46 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
47 | - ), |
|
48 | - new GraphQLOutputField( |
|
49 | - 'cacheId', |
|
50 | - ['non_null' => 'String'], |
|
51 | - null, |
|
52 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
53 | - ), |
|
54 | - new GraphQLField( |
|
55 | - 'isActive', |
|
56 | - 'Boolean', |
|
57 | - null, // 'active', |
|
58 | - esc_html__( |
|
59 | - 'Flag that indicates if the country should appear in dropdown select lists', |
|
60 | - 'event_espresso' |
|
61 | - ) |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'ISO', |
|
65 | - 'String', |
|
66 | - null, // 'ISO', |
|
67 | - esc_html__('Country ISO Code', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLField( |
|
70 | - 'ISO3', |
|
71 | - 'String', |
|
72 | - null, // 'ISO3', |
|
73 | - esc_html__('Country ISO3 Code', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLField( |
|
76 | - 'name', |
|
77 | - 'String', |
|
78 | - 'name', |
|
79 | - esc_html__('Country Name', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'currencyCode', |
|
83 | - 'String', |
|
84 | - 'currency_code', |
|
85 | - esc_html__('Country Currency Code', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLField( |
|
88 | - 'currencySingular', |
|
89 | - 'String', |
|
90 | - 'currency_name_single', |
|
91 | - esc_html__('Currency Name Singular', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLField( |
|
94 | - 'currencyPlural', |
|
95 | - 'String', |
|
96 | - 'currency_name_plural', |
|
97 | - esc_html__('Currency Name Plural', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLField( |
|
100 | - 'currencySign', |
|
101 | - 'String', |
|
102 | - 'currency_sign', |
|
103 | - __('Currency Sign', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'currencySignBeforeNumber', |
|
107 | - 'String', |
|
108 | - 'currency_sign_before', |
|
109 | - esc_html__('Currency Sign Before Number', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'currencyDecimalPlaces', |
|
113 | - 'String', |
|
114 | - 'currency_decimal_places', |
|
115 | - esc_html__('Currency Decimal Places', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLField( |
|
118 | - 'currencyDecimalMark', |
|
119 | - 'String', |
|
120 | - 'currency_decimal_mark', |
|
121 | - esc_html__('Currency Decimal Mark', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'currencyThousandsSeparator', |
|
125 | - 'String', |
|
126 | - 'currency_thousands_separator', |
|
127 | - esc_html__('Currency Thousands Separator', 'event_espresso') |
|
128 | - ), |
|
129 | - ]; |
|
36 | + /** |
|
37 | + * @return GraphQLFieldInterface[] |
|
38 | + */ |
|
39 | + public function getFields(): array |
|
40 | + { |
|
41 | + $fields = [ |
|
42 | + new GraphQLField( |
|
43 | + 'id', |
|
44 | + ['non_null' => 'ID'], |
|
45 | + null, |
|
46 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
47 | + ), |
|
48 | + new GraphQLOutputField( |
|
49 | + 'cacheId', |
|
50 | + ['non_null' => 'String'], |
|
51 | + null, |
|
52 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
53 | + ), |
|
54 | + new GraphQLField( |
|
55 | + 'isActive', |
|
56 | + 'Boolean', |
|
57 | + null, // 'active', |
|
58 | + esc_html__( |
|
59 | + 'Flag that indicates if the country should appear in dropdown select lists', |
|
60 | + 'event_espresso' |
|
61 | + ) |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'ISO', |
|
65 | + 'String', |
|
66 | + null, // 'ISO', |
|
67 | + esc_html__('Country ISO Code', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLField( |
|
70 | + 'ISO3', |
|
71 | + 'String', |
|
72 | + null, // 'ISO3', |
|
73 | + esc_html__('Country ISO3 Code', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLField( |
|
76 | + 'name', |
|
77 | + 'String', |
|
78 | + 'name', |
|
79 | + esc_html__('Country Name', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'currencyCode', |
|
83 | + 'String', |
|
84 | + 'currency_code', |
|
85 | + esc_html__('Country Currency Code', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLField( |
|
88 | + 'currencySingular', |
|
89 | + 'String', |
|
90 | + 'currency_name_single', |
|
91 | + esc_html__('Currency Name Singular', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLField( |
|
94 | + 'currencyPlural', |
|
95 | + 'String', |
|
96 | + 'currency_name_plural', |
|
97 | + esc_html__('Currency Name Plural', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLField( |
|
100 | + 'currencySign', |
|
101 | + 'String', |
|
102 | + 'currency_sign', |
|
103 | + __('Currency Sign', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'currencySignBeforeNumber', |
|
107 | + 'String', |
|
108 | + 'currency_sign_before', |
|
109 | + esc_html__('Currency Sign Before Number', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'currencyDecimalPlaces', |
|
113 | + 'String', |
|
114 | + 'currency_decimal_places', |
|
115 | + esc_html__('Currency Decimal Places', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLField( |
|
118 | + 'currencyDecimalMark', |
|
119 | + 'String', |
|
120 | + 'currency_decimal_mark', |
|
121 | + esc_html__('Currency Decimal Mark', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'currencyThousandsSeparator', |
|
125 | + 'String', |
|
126 | + 'currency_thousands_separator', |
|
127 | + esc_html__('Currency Thousands Separator', 'event_espresso') |
|
128 | + ), |
|
129 | + ]; |
|
130 | 130 | |
131 | - return apply_filters( |
|
132 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__country_fields', |
|
133 | - $fields, |
|
134 | - $this->name, |
|
135 | - $this->model |
|
136 | - ); |
|
137 | - } |
|
131 | + return apply_filters( |
|
132 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__country_fields', |
|
133 | + $fields, |
|
134 | + $this->name, |
|
135 | + $this->model |
|
136 | + ); |
|
137 | + } |
|
138 | 138 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function __construct(EEM_Country $country_model) |
28 | 28 | { |
29 | - $this->setName($this->namespace . 'Country'); |
|
29 | + $this->setName($this->namespace.'Country'); |
|
30 | 30 | $this->setDescription(__('A country', 'event_espresso')); |
31 | 31 | $this->setIsCustomPostType(false); |
32 | 32 | parent::__construct($country_model); |