Completed
Branch EDTR/UI-tweaks-from-qa (c1ef9a)
by
unknown
27:56 queued 18:17
created
core/domain/services/graphql/types/Datetime.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@
 block discarded – undo
234 234
      * @param array       $args    The inputArgs on the field
235 235
      * @param AppContext  $context The AppContext passed down the GraphQL tree
236 236
      * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
237
-     * @return string
237
+     * @return boolean
238 238
      * @throws Exception
239 239
      * @throws InvalidArgumentException
240 240
      * @throws InvalidDataTypeException
Please login to merge, or discard this patch.
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -34,315 +34,315 @@
 block discarded – undo
34 34
 class Datetime extends TypeBase
35 35
 {
36 36
 
37
-    /**
38
-     * EventDate constructor.
39
-     *
40
-     * @param EEM_Datetime $datetime_model
41
-     */
42
-    public function __construct(EEM_Datetime $datetime_model)
43
-    {
44
-        $this->model = $datetime_model;
45
-        $this->setName($this->namespace . 'Datetime');
46
-        $this->setDescription(__('An event date', 'event_espresso'));
47
-        $this->setIsCustomPostType(false);
48
-        parent::__construct();
49
-    }
37
+	/**
38
+	 * EventDate constructor.
39
+	 *
40
+	 * @param EEM_Datetime $datetime_model
41
+	 */
42
+	public function __construct(EEM_Datetime $datetime_model)
43
+	{
44
+		$this->model = $datetime_model;
45
+		$this->setName($this->namespace . 'Datetime');
46
+		$this->setDescription(__('An event date', 'event_espresso'));
47
+		$this->setIsCustomPostType(false);
48
+		parent::__construct();
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * @return GraphQLFieldInterface[]
54
-     * @since $VID:$
55
-     */
56
-    public function getFields()
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
-        ];
52
+	/**
53
+	 * @return GraphQLFieldInterface[]
54
+	 * @since $VID:$
55
+	 */
56
+	public function getFields()
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 string
238
-     * @throws Exception
239
-     * @throws InvalidArgumentException
240
-     * @throws InvalidDataTypeException
241
-     * @throws InvalidInterfaceException
242
-     * @throws ReflectionException
243
-     * @throws UserError
244
-     * @throws UnexpectedEntityException
245
-     * @since $VID:$
246
-     */
247
-    public function getIsTrashed(EE_Datetime $source, array $args, AppContext $context, ResolveInfo $info)
248
-    {
249
-        return (bool) $source->get('DTT_deleted');
250
-    }
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 string
238
+	 * @throws Exception
239
+	 * @throws InvalidArgumentException
240
+	 * @throws InvalidDataTypeException
241
+	 * @throws InvalidInterfaceException
242
+	 * @throws ReflectionException
243
+	 * @throws UserError
244
+	 * @throws UnexpectedEntityException
245
+	 * @since $VID:$
246
+	 */
247
+	public function getIsTrashed(EE_Datetime $source, array $args, AppContext $context, ResolveInfo $info)
248
+	{
249
+		return (bool) $source->get('DTT_deleted');
250
+	}
251 251
 
252 252
 
253
-    /**
254
-     * @param array $inputFields The mutation input fields.
255
-     * @throws InvalidArgumentException
256
-     * @throws ReflectionException
257
-     * @since $VID:$
258
-     */
259
-    public function registerMutations(array $inputFields)
260
-    {
261
-        // Register mutation to update an entity.
262
-        register_graphql_mutation(
263
-            'update' . $this->name(),
264
-            [
265
-                'inputFields'         => $inputFields,
266
-                'outputFields'        => [
267
-                    lcfirst($this->name()) => [
268
-                        'type'    => $this->name(),
269
-                        'resolve' => [$this, 'resolveFromPayload'],
270
-                    ],
271
-                ],
272
-                'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this),
273
-            ]
274
-        );
275
-        // Register mutation to delete an entity.
276
-        register_graphql_mutation(
277
-            'delete' . $this->name(),
278
-            [
279
-                'inputFields'         => [
280
-                    'id'                => $inputFields['id'],
281
-                    'deletePermanently' => [
282
-                        'type'        => 'Boolean',
283
-                        'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
284
-                    ],
285
-                ],
286
-                'outputFields'        => [
287
-                    lcfirst($this->name()) => [
288
-                        'type'        => $this->name(),
289
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
290
-                        'resolve'     => static function ($payload) {
291
-                            $deleted = (object) $payload['deleted'];
253
+	/**
254
+	 * @param array $inputFields The mutation input fields.
255
+	 * @throws InvalidArgumentException
256
+	 * @throws ReflectionException
257
+	 * @since $VID:$
258
+	 */
259
+	public function registerMutations(array $inputFields)
260
+	{
261
+		// Register mutation to update an entity.
262
+		register_graphql_mutation(
263
+			'update' . $this->name(),
264
+			[
265
+				'inputFields'         => $inputFields,
266
+				'outputFields'        => [
267
+					lcfirst($this->name()) => [
268
+						'type'    => $this->name(),
269
+						'resolve' => [$this, 'resolveFromPayload'],
270
+					],
271
+				],
272
+				'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this),
273
+			]
274
+		);
275
+		// Register mutation to delete an entity.
276
+		register_graphql_mutation(
277
+			'delete' . $this->name(),
278
+			[
279
+				'inputFields'         => [
280
+					'id'                => $inputFields['id'],
281
+					'deletePermanently' => [
282
+						'type'        => 'Boolean',
283
+						'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
284
+					],
285
+				],
286
+				'outputFields'        => [
287
+					lcfirst($this->name()) => [
288
+						'type'        => $this->name(),
289
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
290
+						'resolve'     => static function ($payload) {
291
+							$deleted = (object) $payload['deleted'];
292 292
 
293
-                            return ! empty($deleted) ? $deleted : null;
294
-                        },
295
-                    ],
296
-                ],
297
-                'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this),
298
-            ]
299
-        );
293
+							return ! empty($deleted) ? $deleted : null;
294
+						},
295
+					],
296
+				],
297
+				'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this),
298
+			]
299
+		);
300 300
 
301
-        // remove primary key from input.
302
-        unset($inputFields['id']);
303
-        // Register mutation to update an entity.
304
-        register_graphql_mutation(
305
-            'create' . $this->name(),
306
-            [
307
-                'inputFields'         => $inputFields,
308
-                'outputFields'        => [
309
-                    lcfirst($this->name()) => [
310
-                        'type'    => $this->name(),
311
-                        'resolve' => [$this, 'resolveFromPayload'],
312
-                    ],
313
-                ],
314
-                'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this),
315
-            ]
316
-        );
301
+		// remove primary key from input.
302
+		unset($inputFields['id']);
303
+		// Register mutation to update an entity.
304
+		register_graphql_mutation(
305
+			'create' . $this->name(),
306
+			[
307
+				'inputFields'         => $inputFields,
308
+				'outputFields'        => [
309
+					lcfirst($this->name()) => [
310
+						'type'    => $this->name(),
311
+						'resolve' => [$this, 'resolveFromPayload'],
312
+					],
313
+				],
314
+				'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this),
315
+			]
316
+		);
317 317
 
318
-        // Register mutation to update an entity.
319
-        register_graphql_mutation(
320
-            'reorder' . $this->namespace . 'Entities',
321
-            [
322
-                'inputFields'         => [
323
-                    'entityIds'  => [
324
-                        'type'        => [
325
-                            'non_null' => ['list_of' => 'ID'],
326
-                        ],
327
-                        'description' => esc_html__('The reordered list of entity GUIDs.', 'event_espresso'),
328
-                    ],
329
-                    'entityType' => [
330
-                        'type'        => [
331
-                            'non_null' => $this->namespace . 'ModelNameEnum',
332
-                        ],
333
-                        'description' => esc_html__('The entity type for the IDs', 'event_espresso'),
334
-                    ],
335
-                ],
336
-                'outputFields'        => [
337
-                    'ok' => [
338
-                        'type'    => 'Boolean',
339
-                        'resolve' => function ($payload) {
340
-                            return (bool) $payload['ok'];
341
-                        },
342
-                    ],
343
-                ],
344
-                'mutateAndGetPayload' => EntityReorder::mutateAndGetPayload(),
345
-            ]
346
-        );
347
-    }
318
+		// Register mutation to update an entity.
319
+		register_graphql_mutation(
320
+			'reorder' . $this->namespace . 'Entities',
321
+			[
322
+				'inputFields'         => [
323
+					'entityIds'  => [
324
+						'type'        => [
325
+							'non_null' => ['list_of' => 'ID'],
326
+						],
327
+						'description' => esc_html__('The reordered list of entity GUIDs.', 'event_espresso'),
328
+					],
329
+					'entityType' => [
330
+						'type'        => [
331
+							'non_null' => $this->namespace . 'ModelNameEnum',
332
+						],
333
+						'description' => esc_html__('The entity type for the IDs', 'event_espresso'),
334
+					],
335
+				],
336
+				'outputFields'        => [
337
+					'ok' => [
338
+						'type'    => 'Boolean',
339
+						'resolve' => function ($payload) {
340
+							return (bool) $payload['ok'];
341
+						},
342
+					],
343
+				],
344
+				'mutateAndGetPayload' => EntityReorder::mutateAndGetPayload(),
345
+			]
346
+		);
347
+	}
348 348
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Ticket.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@
 block discarded – undo
311 311
      * @param array       $args    The inputArgs on the field
312 312
      * @param AppContext  $context The AppContext passed down the GraphQL tree
313 313
      * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
314
-     * @return string
314
+     * @return boolean
315 315
      * @throws Exception
316 316
      * @throws InvalidArgumentException
317 317
      * @throws InvalidDataTypeException
Please login to merge, or discard this patch.
Indentation   +350 added lines, -350 removed lines patch added patch discarded remove patch
@@ -33,363 +33,363 @@
 block discarded – undo
33 33
 class Ticket extends TypeBase
34 34
 {
35 35
 
36
-    /**
37
-     * Ticket constructor.
38
-     *
39
-     * @param EEM_Ticket $ticket_model
40
-     */
41
-    public function __construct(EEM_Ticket $ticket_model)
42
-    {
43
-        $this->model = $ticket_model;
44
-        $this->setName($this->namespace . 'Ticket');
45
-        $this->setDescription(__('A ticket for an event date', 'event_espresso'));
46
-        $this->setIsCustomPostType(false);
47
-        parent::__construct();
48
-    }
36
+	/**
37
+	 * Ticket constructor.
38
+	 *
39
+	 * @param EEM_Ticket $ticket_model
40
+	 */
41
+	public function __construct(EEM_Ticket $ticket_model)
42
+	{
43
+		$this->model = $ticket_model;
44
+		$this->setName($this->namespace . 'Ticket');
45
+		$this->setDescription(__('A ticket for an event date', 'event_espresso'));
46
+		$this->setIsCustomPostType(false);
47
+		parent::__construct();
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * @return GraphQLFieldInterface[]
53
-     * @since $VID:$
54
-     */
55
-    public function getFields()
56
-    {
57
-        $fields = [
58
-            new GraphQLField(
59
-                'id',
60
-                ['non_null' => 'ID'],
61
-                null,
62
-                esc_html__('The globally unique ID for the object.', 'event_espresso')
63
-            ),
64
-            new GraphQLOutputField(
65
-                'dbId',
66
-                ['non_null' => 'Int'],
67
-                'ID',
68
-                esc_html__('Ticket ID', 'event_espresso')
69
-            ),
70
-            new GraphQLOutputField(
71
-                'cacheId',
72
-                ['non_null' => 'String'],
73
-                null,
74
-                esc_html__('The cache ID of the object.', 'event_espresso')
75
-            ),
76
-            new GraphQLInputField(
77
-                'datetimes',
78
-                ['list_of' => 'ID'],
79
-                null,
80
-                sprintf(
81
-                    '%1$s %2$s',
82
-                    esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'),
83
-                    esc_html__('Ignored if empty.', 'event_espresso')
84
-                )
85
-            ),
86
-            new GraphQLField(
87
-                'description',
88
-                'String',
89
-                'description',
90
-                esc_html__('Description of Ticket', 'event_espresso')
91
-            ),
92
-            new GraphQLField(
93
-                'endDate',
94
-                'String',
95
-                'end_date',
96
-                esc_html__('End date and time of the Ticket', 'event_espresso'),
97
-                [$this, 'formatDatetime']
98
-            ),
99
-            new GraphQLOutputField(
100
-                'event',
101
-                $this->namespace . 'Event',
102
-                null,
103
-                esc_html__('Event of the ticket.', 'event_espresso')
104
-            ),
105
-            new GraphQLField(
106
-                'isDefault',
107
-                'Boolean',
108
-                'is_default',
109
-                esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso')
110
-            ),
111
-            new GraphQLOutputField(
112
-                'isExpired',
113
-                'Boolean',
114
-                'is_expired',
115
-                esc_html__('Flag indicating ticket is no longer available because its available dates have expired', 'event_espresso')
116
-            ),
117
-            new GraphQLOutputField(
118
-                'isFree',
119
-                'Boolean',
120
-                'is_free',
121
-                esc_html__('Flag indicating whether the ticket is free.', 'event_espresso')
122
-            ),
123
-            new GraphQLOutputField(
124
-                'isOnSale',
125
-                'Boolean',
126
-                'is_on_sale',
127
-                esc_html__('Flag indicating ticket ticket is on sale or not', 'event_espresso')
128
-            ),
129
-            new GraphQLOutputField(
130
-                'isPending',
131
-                'Boolean',
132
-                'is_pending',
133
-                esc_html__('Flag indicating ticket is yet to go on sale or not', 'event_espresso')
134
-            ),
135
-            new GraphQLField(
136
-                'isRequired',
137
-                'Boolean',
138
-                'required',
139
-                esc_html__(
140
-                    'Flag indicating whether this ticket must be purchased with a transaction',
141
-                    'event_espresso'
142
-                )
143
-            ),
144
-            new GraphQLOutputField(
145
-                'isSoldOut',
146
-                'Boolean',
147
-                null,
148
-                esc_html__('Flag indicating whether the ticket is sold out', 'event_espresso'),
149
-                null,
150
-                [$this, 'getIsSoldOut']
151
-            ),
152
-            new GraphQLField(
153
-                'isTaxable',
154
-                'Boolean',
155
-                'taxable',
156
-                esc_html__(
157
-                    'Flag indicating whether there is tax applied on this ticket',
158
-                    'event_espresso'
159
-                )
160
-            ),
161
-            new GraphQLField(
162
-                'isTrashed',
163
-                'Boolean',
164
-                'deleted',
165
-                esc_html__('Flag indicating ticket has been trashed.', 'event_espresso')
166
-            ),
167
-            new GraphQLField(
168
-                'max',
169
-                'Int',
170
-                'max',
171
-                esc_html__(
172
-                    'Maximum quantity of this ticket that can be purchased in one transaction',
173
-                    'event_espresso'
174
-                ),
175
-                [$this, 'parseInfiniteValue']
176
-            ),
177
-            new GraphQLField(
178
-                'min',
179
-                'Int',
180
-                'min',
181
-                esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso')
182
-            ),
183
-            new GraphQLField(
184
-                'name',
185
-                'String',
186
-                'name',
187
-                esc_html__('Ticket Name', 'event_espresso')
188
-            ),
189
-            new GraphQLField(
190
-                'order',
191
-                'Int',
192
-                'order',
193
-                esc_html__('The order in which the Datetime is displayed', 'event_espresso')
194
-            ),
195
-            new GraphQLOutputField(
196
-                'parent',
197
-                $this->name(),
198
-                null,
199
-                esc_html__('The parent ticket of the current ticket', 'event_espresso')
200
-            ),
201
-            new GraphQLInputField(
202
-                'parent',
203
-                'ID',
204
-                null,
205
-                esc_html__('The parent ticket ID', 'event_espresso')
206
-            ),
207
-            new GraphQLField(
208
-                'price',
209
-                'Float',
210
-                'price',
211
-                esc_html__('Final calculated price for ticket', 'event_espresso')
212
-            ),
213
-            new GraphQLInputField(
214
-                'prices',
215
-                ['list_of' => 'ID'],
216
-                null,
217
-                sprintf(
218
-                    '%1$s %2$s',
219
-                    esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'),
220
-                    esc_html__('Ignored if empty.', 'event_espresso')
221
-                )
222
-            ),
223
-            new GraphQLField(
224
-                'quantity',
225
-                'Int',
226
-                'qty',
227
-                esc_html__('Quantity of this ticket that is available', 'event_espresso'),
228
-                [$this, 'parseInfiniteValue']
229
-            ),
230
-            new GraphQLOutputField(
231
-                'registrationCount',
232
-                'Int',
233
-                'count_registrations',
234
-                esc_html__('Number of registrations for the ticket', 'event_espresso')
235
-            ),
236
-            new GraphQLField(
237
-                'reserved',
238
-                'Int',
239
-                'reserved',
240
-                esc_html__(
241
-                    'Quantity of this ticket that is reserved, but not yet fully purchased',
242
-                    'event_espresso'
243
-                )
244
-            ),
245
-            new GraphQLField(
246
-                'reverseCalculate',
247
-                'Boolean',
248
-                'reverse_calculate',
249
-                esc_html__(
250
-                    'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.',
251
-                    'event_espresso'
252
-                )
253
-            ),
254
-            new GraphQLField(
255
-                'row',
256
-                'Int',
257
-                'row',
258
-                esc_html__('How tickets are displayed in the ui', 'event_espresso')
259
-            ),
260
-            new GraphQLField(
261
-                'sold',
262
-                'Int',
263
-                'sold',
264
-                esc_html__('Number of this ticket sold', 'event_espresso')
265
-            ),
266
-            new GraphQLOutputField(
267
-                'status',
268
-                $this->namespace . 'TicketStatusEnum',
269
-                'ticket_status',
270
-                esc_html__('Ticket status', 'event_espresso')
271
-            ),
272
-            new GraphQLField(
273
-                'startDate',
274
-                'String',
275
-                'start_date',
276
-                esc_html__('Start date and time of the Ticket', 'event_espresso'),
277
-                [$this, 'formatDatetime']
278
-            ),
279
-            new GraphQLField(
280
-                'uses',
281
-                'Int',
282
-                'uses',
283
-                esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
284
-                [$this, 'parseInfiniteValue']
285
-            ),
286
-            new GraphQLOutputField(
287
-                'wpUser',
288
-                'User',
289
-                null,
290
-                esc_html__('Ticket Creator', 'event_espresso')
291
-            ),
292
-            new GraphQLInputField(
293
-                'wpUser',
294
-                'Int',
295
-                null,
296
-                esc_html__('Ticket Creator ID', 'event_espresso')
297
-            ),
298
-        ];
51
+	/**
52
+	 * @return GraphQLFieldInterface[]
53
+	 * @since $VID:$
54
+	 */
55
+	public function getFields()
56
+	{
57
+		$fields = [
58
+			new GraphQLField(
59
+				'id',
60
+				['non_null' => 'ID'],
61
+				null,
62
+				esc_html__('The globally unique ID for the object.', 'event_espresso')
63
+			),
64
+			new GraphQLOutputField(
65
+				'dbId',
66
+				['non_null' => 'Int'],
67
+				'ID',
68
+				esc_html__('Ticket ID', 'event_espresso')
69
+			),
70
+			new GraphQLOutputField(
71
+				'cacheId',
72
+				['non_null' => 'String'],
73
+				null,
74
+				esc_html__('The cache ID of the object.', 'event_espresso')
75
+			),
76
+			new GraphQLInputField(
77
+				'datetimes',
78
+				['list_of' => 'ID'],
79
+				null,
80
+				sprintf(
81
+					'%1$s %2$s',
82
+					esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'),
83
+					esc_html__('Ignored if empty.', 'event_espresso')
84
+				)
85
+			),
86
+			new GraphQLField(
87
+				'description',
88
+				'String',
89
+				'description',
90
+				esc_html__('Description of Ticket', 'event_espresso')
91
+			),
92
+			new GraphQLField(
93
+				'endDate',
94
+				'String',
95
+				'end_date',
96
+				esc_html__('End date and time of the Ticket', 'event_espresso'),
97
+				[$this, 'formatDatetime']
98
+			),
99
+			new GraphQLOutputField(
100
+				'event',
101
+				$this->namespace . 'Event',
102
+				null,
103
+				esc_html__('Event of the ticket.', 'event_espresso')
104
+			),
105
+			new GraphQLField(
106
+				'isDefault',
107
+				'Boolean',
108
+				'is_default',
109
+				esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso')
110
+			),
111
+			new GraphQLOutputField(
112
+				'isExpired',
113
+				'Boolean',
114
+				'is_expired',
115
+				esc_html__('Flag indicating ticket is no longer available because its available dates have expired', 'event_espresso')
116
+			),
117
+			new GraphQLOutputField(
118
+				'isFree',
119
+				'Boolean',
120
+				'is_free',
121
+				esc_html__('Flag indicating whether the ticket is free.', 'event_espresso')
122
+			),
123
+			new GraphQLOutputField(
124
+				'isOnSale',
125
+				'Boolean',
126
+				'is_on_sale',
127
+				esc_html__('Flag indicating ticket ticket is on sale or not', 'event_espresso')
128
+			),
129
+			new GraphQLOutputField(
130
+				'isPending',
131
+				'Boolean',
132
+				'is_pending',
133
+				esc_html__('Flag indicating ticket is yet to go on sale or not', 'event_espresso')
134
+			),
135
+			new GraphQLField(
136
+				'isRequired',
137
+				'Boolean',
138
+				'required',
139
+				esc_html__(
140
+					'Flag indicating whether this ticket must be purchased with a transaction',
141
+					'event_espresso'
142
+				)
143
+			),
144
+			new GraphQLOutputField(
145
+				'isSoldOut',
146
+				'Boolean',
147
+				null,
148
+				esc_html__('Flag indicating whether the ticket is sold out', 'event_espresso'),
149
+				null,
150
+				[$this, 'getIsSoldOut']
151
+			),
152
+			new GraphQLField(
153
+				'isTaxable',
154
+				'Boolean',
155
+				'taxable',
156
+				esc_html__(
157
+					'Flag indicating whether there is tax applied on this ticket',
158
+					'event_espresso'
159
+				)
160
+			),
161
+			new GraphQLField(
162
+				'isTrashed',
163
+				'Boolean',
164
+				'deleted',
165
+				esc_html__('Flag indicating ticket has been trashed.', 'event_espresso')
166
+			),
167
+			new GraphQLField(
168
+				'max',
169
+				'Int',
170
+				'max',
171
+				esc_html__(
172
+					'Maximum quantity of this ticket that can be purchased in one transaction',
173
+					'event_espresso'
174
+				),
175
+				[$this, 'parseInfiniteValue']
176
+			),
177
+			new GraphQLField(
178
+				'min',
179
+				'Int',
180
+				'min',
181
+				esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso')
182
+			),
183
+			new GraphQLField(
184
+				'name',
185
+				'String',
186
+				'name',
187
+				esc_html__('Ticket Name', 'event_espresso')
188
+			),
189
+			new GraphQLField(
190
+				'order',
191
+				'Int',
192
+				'order',
193
+				esc_html__('The order in which the Datetime is displayed', 'event_espresso')
194
+			),
195
+			new GraphQLOutputField(
196
+				'parent',
197
+				$this->name(),
198
+				null,
199
+				esc_html__('The parent ticket of the current ticket', 'event_espresso')
200
+			),
201
+			new GraphQLInputField(
202
+				'parent',
203
+				'ID',
204
+				null,
205
+				esc_html__('The parent ticket ID', 'event_espresso')
206
+			),
207
+			new GraphQLField(
208
+				'price',
209
+				'Float',
210
+				'price',
211
+				esc_html__('Final calculated price for ticket', 'event_espresso')
212
+			),
213
+			new GraphQLInputField(
214
+				'prices',
215
+				['list_of' => 'ID'],
216
+				null,
217
+				sprintf(
218
+					'%1$s %2$s',
219
+					esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'),
220
+					esc_html__('Ignored if empty.', 'event_espresso')
221
+				)
222
+			),
223
+			new GraphQLField(
224
+				'quantity',
225
+				'Int',
226
+				'qty',
227
+				esc_html__('Quantity of this ticket that is available', 'event_espresso'),
228
+				[$this, 'parseInfiniteValue']
229
+			),
230
+			new GraphQLOutputField(
231
+				'registrationCount',
232
+				'Int',
233
+				'count_registrations',
234
+				esc_html__('Number of registrations for the ticket', 'event_espresso')
235
+			),
236
+			new GraphQLField(
237
+				'reserved',
238
+				'Int',
239
+				'reserved',
240
+				esc_html__(
241
+					'Quantity of this ticket that is reserved, but not yet fully purchased',
242
+					'event_espresso'
243
+				)
244
+			),
245
+			new GraphQLField(
246
+				'reverseCalculate',
247
+				'Boolean',
248
+				'reverse_calculate',
249
+				esc_html__(
250
+					'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.',
251
+					'event_espresso'
252
+				)
253
+			),
254
+			new GraphQLField(
255
+				'row',
256
+				'Int',
257
+				'row',
258
+				esc_html__('How tickets are displayed in the ui', 'event_espresso')
259
+			),
260
+			new GraphQLField(
261
+				'sold',
262
+				'Int',
263
+				'sold',
264
+				esc_html__('Number of this ticket sold', 'event_espresso')
265
+			),
266
+			new GraphQLOutputField(
267
+				'status',
268
+				$this->namespace . 'TicketStatusEnum',
269
+				'ticket_status',
270
+				esc_html__('Ticket status', 'event_espresso')
271
+			),
272
+			new GraphQLField(
273
+				'startDate',
274
+				'String',
275
+				'start_date',
276
+				esc_html__('Start date and time of the Ticket', 'event_espresso'),
277
+				[$this, 'formatDatetime']
278
+			),
279
+			new GraphQLField(
280
+				'uses',
281
+				'Int',
282
+				'uses',
283
+				esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
284
+				[$this, 'parseInfiniteValue']
285
+			),
286
+			new GraphQLOutputField(
287
+				'wpUser',
288
+				'User',
289
+				null,
290
+				esc_html__('Ticket Creator', 'event_espresso')
291
+			),
292
+			new GraphQLInputField(
293
+				'wpUser',
294
+				'Int',
295
+				null,
296
+				esc_html__('Ticket Creator ID', 'event_espresso')
297
+			),
298
+		];
299 299
 
300
-        return apply_filters(
301
-            'FHEE__EventEspresso_core_domain_services_graphql_types__ticket_fields',
302
-            $fields,
303
-            $this->name,
304
-            $this->model
305
-        );
306
-    }
300
+		return apply_filters(
301
+			'FHEE__EventEspresso_core_domain_services_graphql_types__ticket_fields',
302
+			$fields,
303
+			$this->name,
304
+			$this->model
305
+		);
306
+	}
307 307
 
308 308
 
309
-    /**
310
-     * @param EE_Ticket   $source  The source that's passed down the GraphQL queries
311
-     * @param array       $args    The inputArgs on the field
312
-     * @param AppContext  $context The AppContext passed down the GraphQL tree
313
-     * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
314
-     * @return string
315
-     * @throws Exception
316
-     * @throws InvalidArgumentException
317
-     * @throws InvalidDataTypeException
318
-     * @throws InvalidInterfaceException
319
-     * @throws ReflectionException
320
-     * @throws UserError
321
-     * @throws UnexpectedEntityException
322
-     * @since $VID:$
323
-     */
324
-    public function getIsSoldOut(EE_Ticket $source, array $args, AppContext $context, ResolveInfo $info)
325
-    {
326
-        return $source->ticket_status() === EE_Ticket::sold_out;
327
-    }
309
+	/**
310
+	 * @param EE_Ticket   $source  The source that's passed down the GraphQL queries
311
+	 * @param array       $args    The inputArgs on the field
312
+	 * @param AppContext  $context The AppContext passed down the GraphQL tree
313
+	 * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
314
+	 * @return string
315
+	 * @throws Exception
316
+	 * @throws InvalidArgumentException
317
+	 * @throws InvalidDataTypeException
318
+	 * @throws InvalidInterfaceException
319
+	 * @throws ReflectionException
320
+	 * @throws UserError
321
+	 * @throws UnexpectedEntityException
322
+	 * @since $VID:$
323
+	 */
324
+	public function getIsSoldOut(EE_Ticket $source, array $args, AppContext $context, ResolveInfo $info)
325
+	{
326
+		return $source->ticket_status() === EE_Ticket::sold_out;
327
+	}
328 328
 
329 329
 
330
-    /**
331
-     * @param array $inputFields The mutation input fields.
332
-     * @throws InvalidArgumentException
333
-     * @throws ReflectionException
334
-     * @since $VID:$
335
-     */
336
-    public function registerMutations(array $inputFields)
337
-    {
338
-        // Register mutation to update an entity.
339
-        register_graphql_mutation(
340
-            'update' . $this->name(),
341
-            [
342
-                'inputFields'         => $inputFields,
343
-                'outputFields'        => [
344
-                    lcfirst($this->name()) => [
345
-                        'type'    => $this->name(),
346
-                        'resolve' => [$this, 'resolveFromPayload'],
347
-                    ],
348
-                ],
349
-                'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this),
350
-            ]
351
-        );
352
-        // Register mutation to delete an entity.
353
-        register_graphql_mutation(
354
-            'delete' . $this->name(),
355
-            [
356
-                'inputFields'         => [
357
-                    'id'                => $inputFields['id'],
358
-                    'deletePermanently' => [
359
-                        'type'        => 'Boolean',
360
-                        'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
361
-                    ],
362
-                ],
363
-                'outputFields'        => [
364
-                    lcfirst($this->name()) => [
365
-                        'type'        => $this->name(),
366
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
367
-                        'resolve'     => static function ($payload) {
368
-                            $deleted = (object) $payload['deleted'];
330
+	/**
331
+	 * @param array $inputFields The mutation input fields.
332
+	 * @throws InvalidArgumentException
333
+	 * @throws ReflectionException
334
+	 * @since $VID:$
335
+	 */
336
+	public function registerMutations(array $inputFields)
337
+	{
338
+		// Register mutation to update an entity.
339
+		register_graphql_mutation(
340
+			'update' . $this->name(),
341
+			[
342
+				'inputFields'         => $inputFields,
343
+				'outputFields'        => [
344
+					lcfirst($this->name()) => [
345
+						'type'    => $this->name(),
346
+						'resolve' => [$this, 'resolveFromPayload'],
347
+					],
348
+				],
349
+				'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this),
350
+			]
351
+		);
352
+		// Register mutation to delete an entity.
353
+		register_graphql_mutation(
354
+			'delete' . $this->name(),
355
+			[
356
+				'inputFields'         => [
357
+					'id'                => $inputFields['id'],
358
+					'deletePermanently' => [
359
+						'type'        => 'Boolean',
360
+						'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
361
+					],
362
+				],
363
+				'outputFields'        => [
364
+					lcfirst($this->name()) => [
365
+						'type'        => $this->name(),
366
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
367
+						'resolve'     => static function ($payload) {
368
+							$deleted = (object) $payload['deleted'];
369 369
 
370
-                            return ! empty($deleted) ? $deleted : null;
371
-                        },
372
-                    ],
373
-                ],
374
-                'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this),
375
-            ]
376
-        );
370
+							return ! empty($deleted) ? $deleted : null;
371
+						},
372
+					],
373
+				],
374
+				'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this),
375
+			]
376
+		);
377 377
 
378
-        // remove primary key from input.
379
-        unset($inputFields['id']);
380
-        // Register mutation to update an entity.
381
-        register_graphql_mutation(
382
-            'create' . $this->name(),
383
-            [
384
-                'inputFields'         => $inputFields,
385
-                'outputFields'        => [
386
-                    lcfirst($this->name()) => [
387
-                        'type'    => $this->name(),
388
-                        'resolve' => [$this, 'resolveFromPayload'],
389
-                    ],
390
-                ],
391
-                'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this),
392
-            ]
393
-        );
394
-    }
378
+		// remove primary key from input.
379
+		unset($inputFields['id']);
380
+		// Register mutation to update an entity.
381
+		register_graphql_mutation(
382
+			'create' . $this->name(),
383
+			[
384
+				'inputFields'         => $inputFields,
385
+				'outputFields'        => [
386
+					lcfirst($this->name()) => [
387
+						'type'    => $this->name(),
388
+						'resolve' => [$this, 'resolveFromPayload'],
389
+					],
390
+				],
391
+				'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this),
392
+			]
393
+		);
394
+	}
395 395
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/DatetimeTicketsConnection.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -20,91 +20,91 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * DatetimeConnection constructor.
25
-     *
26
-     * @param EEM_Ticket $model
27
-     */
28
-    public function __construct(EEM_Ticket $model)
29
-    {
30
-        $this->model = $model;
31
-    }
23
+	/**
24
+	 * DatetimeConnection constructor.
25
+	 *
26
+	 * @param EEM_Ticket $model
27
+	 */
28
+	public function __construct(EEM_Ticket $model)
29
+	{
30
+		$this->model = $model;
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * @return array
36
-     * @since $VID:$
37
-     */
38
-    public function config()
39
-    {
40
-        return [
41
-            'fromType'           => $this->namespace . 'Datetime',
42
-            'toType'             => $this->namespace . 'Ticket',
43
-            'fromFieldName'      => 'tickets',
44
-            'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection",
45
-            'connectionArgs'     => self::get_connection_args(),
46
-            'resolve'            => [$this, 'resolveConnection'],
47
-        ];
48
-    }
34
+	/**
35
+	 * @return array
36
+	 * @since $VID:$
37
+	 */
38
+	public function config()
39
+	{
40
+		return [
41
+			'fromType'           => $this->namespace . 'Datetime',
42
+			'toType'             => $this->namespace . 'Ticket',
43
+			'fromFieldName'      => 'tickets',
44
+			'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection",
45
+			'connectionArgs'     => self::get_connection_args(),
46
+			'resolve'            => [$this, 'resolveConnection'],
47
+		];
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * @param $entity
53
-     * @param $args
54
-     * @param $context
55
-     * @param $info
56
-     * @return array
57
-     * @throws Exception
58
-     * @since $VID:$
59
-     */
60
-    public function resolveConnection($entity, $args, $context, $info)
61
-    {
62
-        $resolver = new TicketConnectionResolver($entity, $args, $context, $info);
63
-        return $resolver->get_connection();
64
-    }
51
+	/**
52
+	 * @param $entity
53
+	 * @param $args
54
+	 * @param $context
55
+	 * @param $info
56
+	 * @return array
57
+	 * @throws Exception
58
+	 * @since $VID:$
59
+	 */
60
+	public function resolveConnection($entity, $args, $context, $info)
61
+	{
62
+		$resolver = new TicketConnectionResolver($entity, $args, $context, $info);
63
+		return $resolver->get_connection();
64
+	}
65 65
 
66
-    /**
67
-     * Given an optional array of args, this returns the args to be used in the connection
68
-     *
69
-     * @access public
70
-     * @param array $args The args to modify the defaults
71
-     *
72
-     * @return array
73
-     */
74
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
75
-    public static function get_connection_args($args = [])
76
-    {
77
-        $newArgs = [
78
-            'orderby'      => [
79
-                'type'        => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'],
80
-                'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
81
-            ],
82
-            'datetime' => [
83
-                'type'        => 'ID',
84
-                'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'),
85
-            ],
86
-            'datetimeIn' => [
87
-                'type'        => ['list_of' => 'ID'],
88
-                'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'),
89
-            ],
90
-            'datetimeId' => [
91
-                'type'        => 'Int',
92
-                'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'),
93
-            ],
94
-            'datetimeIdIn' => [
95
-                'type'        => ['list_of' => 'Int'],
96
-                'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'),
97
-            ],
98
-        ];
66
+	/**
67
+	 * Given an optional array of args, this returns the args to be used in the connection
68
+	 *
69
+	 * @access public
70
+	 * @param array $args The args to modify the defaults
71
+	 *
72
+	 * @return array
73
+	 */
74
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
75
+	public static function get_connection_args($args = [])
76
+	{
77
+		$newArgs = [
78
+			'orderby'      => [
79
+				'type'        => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'],
80
+				'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
81
+			],
82
+			'datetime' => [
83
+				'type'        => 'ID',
84
+				'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'),
85
+			],
86
+			'datetimeIn' => [
87
+				'type'        => ['list_of' => 'ID'],
88
+				'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'),
89
+			],
90
+			'datetimeId' => [
91
+				'type'        => 'Int',
92
+				'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'),
93
+			],
94
+			'datetimeIdIn' => [
95
+				'type'        => ['list_of' => 'Int'],
96
+				'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'),
97
+			],
98
+		];
99 99
 
100
-        $newArgs = apply_filters(
101
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args',
102
-            $newArgs,
103
-            $args
104
-        );
105
-        return array_merge(
106
-            $newArgs,
107
-            $args
108
-        );
109
-    }
100
+		$newArgs = apply_filters(
101
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args',
102
+			$newArgs,
103
+			$args
104
+		);
105
+		return array_merge(
106
+			$newArgs,
107
+			$args
108
+		);
109
+	}
110 110
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/RootQueryAttendeesConnection.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -19,128 +19,128 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * AttendeeConnection constructor.
24
-     *
25
-     * @param EEM_Attendee               $model
26
-     */
27
-    public function __construct(EEM_Attendee $model)
28
-    {
29
-        $this->model = $model;
30
-    }
22
+	/**
23
+	 * AttendeeConnection constructor.
24
+	 *
25
+	 * @param EEM_Attendee               $model
26
+	 */
27
+	public function __construct(EEM_Attendee $model)
28
+	{
29
+		$this->model = $model;
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * @return array
35
-     * @since $VID:$
36
-     */
37
-    public function config()
38
-    {
39
-        return [
40
-            'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Attendee',
42
-            'fromFieldName'      => lcfirst($this->namespace) . 'Attendees',
43
-            'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection",
44
-            'connectionArgs'     => self::get_connection_args(),
45
-            'resolve'            => [$this, 'resolveConnection'],
46
-        ];
47
-    }
33
+	/**
34
+	 * @return array
35
+	 * @since $VID:$
36
+	 */
37
+	public function config()
38
+	{
39
+		return [
40
+			'fromType'           => 'RootQuery',
41
+			'toType'             => $this->namespace . 'Attendee',
42
+			'fromFieldName'      => lcfirst($this->namespace) . 'Attendees',
43
+			'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection",
44
+			'connectionArgs'     => self::get_connection_args(),
45
+			'resolve'            => [$this, 'resolveConnection'],
46
+		];
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @param $entity
52
-     * @param $args
53
-     * @param $context
54
-     * @param $info
55
-     * @return AttendeeConnectionResolver
56
-     * @throws Exception
57
-     * @since $VID:$
58
-     */
59
-    public function getConnectionResolver($entity, $args, $context, $info)
60
-    {
61
-        return new AttendeeConnectionResolver($entity, $args, $context, $info);
62
-    }
50
+	/**
51
+	 * @param $entity
52
+	 * @param $args
53
+	 * @param $context
54
+	 * @param $info
55
+	 * @return AttendeeConnectionResolver
56
+	 * @throws Exception
57
+	 * @since $VID:$
58
+	 */
59
+	public function getConnectionResolver($entity, $args, $context, $info)
60
+	{
61
+		return new AttendeeConnectionResolver($entity, $args, $context, $info);
62
+	}
63 63
 
64
-    /**
65
-     * Given an optional array of args, this returns the args to be used in the connection
66
-     *
67
-     * @access public
68
-     * @param array $args The args to modify the defaults
69
-     *
70
-     * @return array
71
-     */
72
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
73
-    public static function get_connection_args($args = [])
74
-    {
75
-        $newArgs = [
76
-            'datetime' => [
77
-                'type'        => 'ID',
78
-                'description' => esc_html__(
79
-                    'Globally unique datetime ID to get the attendees for.',
80
-                    'event_espresso'
81
-                ),
82
-            ],
83
-            'datetimeIn' => [
84
-                'type'        => ['list_of' => 'ID'],
85
-                'description' => esc_html__(
86
-                    'Globally unique datetime IDs to get the attendees for.',
87
-                    'event_espresso'
88
-                ),
89
-            ],
90
-            'event' => [
91
-                'type'        => 'ID',
92
-                'description' => esc_html__(
93
-                    'Globally unique event ID to get the attendees for.',
94
-                    'event_espresso'
95
-                ),
96
-            ],
97
-            'eventIn' => [
98
-                'type'        => ['list_of' => 'ID'],
99
-                'description' => esc_html__(
100
-                    'Globally unique event IDs to get the attendees for.',
101
-                    'event_espresso'
102
-                ),
103
-            ],
104
-            'orderby'      => [
105
-                'type'        => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'],
106
-                'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
107
-            ],
108
-            'regTicket' => [
109
-                'type'        => 'ID',
110
-                'description' => esc_html__(
111
-                    'Globally unique registration ticket ID to get the attendees for.',
112
-                    'event_espresso'
113
-                ),
114
-            ],
115
-            'regTicketIn' => [
116
-                'type'        => ['list_of' => 'ID'],
117
-                'description' => esc_html__(
118
-                    'Globally unique registration ticket IDs to get the attendees for.',
119
-                    'event_espresso'
120
-                ),
121
-            ],
122
-            'regTicketId' => [
123
-                'type'        => 'Int',
124
-                'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'),
125
-            ],
126
-            'regTicketIdIn' => [
127
-                'type'        => ['list_of' => 'Int'],
128
-                'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'),
129
-            ],
130
-            'regStatus' => [
131
-                'type'        => 'EspressoRegistrationStatusEnum',
132
-                'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'),
133
-            ],
134
-        ];
64
+	/**
65
+	 * Given an optional array of args, this returns the args to be used in the connection
66
+	 *
67
+	 * @access public
68
+	 * @param array $args The args to modify the defaults
69
+	 *
70
+	 * @return array
71
+	 */
72
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
73
+	public static function get_connection_args($args = [])
74
+	{
75
+		$newArgs = [
76
+			'datetime' => [
77
+				'type'        => 'ID',
78
+				'description' => esc_html__(
79
+					'Globally unique datetime ID to get the attendees for.',
80
+					'event_espresso'
81
+				),
82
+			],
83
+			'datetimeIn' => [
84
+				'type'        => ['list_of' => 'ID'],
85
+				'description' => esc_html__(
86
+					'Globally unique datetime IDs to get the attendees for.',
87
+					'event_espresso'
88
+				),
89
+			],
90
+			'event' => [
91
+				'type'        => 'ID',
92
+				'description' => esc_html__(
93
+					'Globally unique event ID to get the attendees for.',
94
+					'event_espresso'
95
+				),
96
+			],
97
+			'eventIn' => [
98
+				'type'        => ['list_of' => 'ID'],
99
+				'description' => esc_html__(
100
+					'Globally unique event IDs to get the attendees for.',
101
+					'event_espresso'
102
+				),
103
+			],
104
+			'orderby'      => [
105
+				'type'        => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'],
106
+				'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
107
+			],
108
+			'regTicket' => [
109
+				'type'        => 'ID',
110
+				'description' => esc_html__(
111
+					'Globally unique registration ticket ID to get the attendees for.',
112
+					'event_espresso'
113
+				),
114
+			],
115
+			'regTicketIn' => [
116
+				'type'        => ['list_of' => 'ID'],
117
+				'description' => esc_html__(
118
+					'Globally unique registration ticket IDs to get the attendees for.',
119
+					'event_espresso'
120
+				),
121
+			],
122
+			'regTicketId' => [
123
+				'type'        => 'Int',
124
+				'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'),
125
+			],
126
+			'regTicketIdIn' => [
127
+				'type'        => ['list_of' => 'Int'],
128
+				'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'),
129
+			],
130
+			'regStatus' => [
131
+				'type'        => 'EspressoRegistrationStatusEnum',
132
+				'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'),
133
+			],
134
+		];
135 135
 
136
-        $newArgs = apply_filters(
137
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__attendee_args',
138
-            $newArgs,
139
-            $args
140
-        );
141
-        return array_merge(
142
-            $newArgs,
143
-            $args
144
-        );
145
-    }
136
+		$newArgs = apply_filters(
137
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__attendee_args',
138
+			$newArgs,
139
+			$args
140
+		);
141
+		return array_merge(
142
+			$newArgs,
143
+			$args
144
+		);
145
+	}
146 146
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/EventDatetimesConnection.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -21,119 +21,119 @@
 block discarded – undo
21 21
 {
22 22
 
23 23
 
24
-    /**
25
-     * DatetimeConnection constructor.
26
-     *
27
-     * @param EEM_Datetime               $model
28
-     */
29
-    public function __construct(EEM_Datetime $model)
30
-    {
31
-        $this->model = $model;
32
-    }
24
+	/**
25
+	 * DatetimeConnection constructor.
26
+	 *
27
+	 * @param EEM_Datetime               $model
28
+	 */
29
+	public function __construct(EEM_Datetime $model)
30
+	{
31
+		$this->model = $model;
32
+	}
33 33
 
34 34
 
35
-    /**
36
-     * @return array
37
-     * @since $VID:$
38
-     */
39
-    public function config()
40
-    {
41
-        return [
42
-            'fromType'           => $this->namespace . 'Event',
43
-            'toType'             => $this->namespace . 'Datetime',
44
-            'fromFieldName'      => 'datetimes',
45
-            'connectionTypeName' => "{$this->namespace}EventDatetimesConnection",
46
-            'connectionArgs'     => self::get_connection_args(),
47
-            'resolve'            => [$this, 'resolveConnection'],
48
-        ];
49
-    }
35
+	/**
36
+	 * @return array
37
+	 * @since $VID:$
38
+	 */
39
+	public function config()
40
+	{
41
+		return [
42
+			'fromType'           => $this->namespace . 'Event',
43
+			'toType'             => $this->namespace . 'Datetime',
44
+			'fromFieldName'      => 'datetimes',
45
+			'connectionTypeName' => "{$this->namespace}EventDatetimesConnection",
46
+			'connectionArgs'     => self::get_connection_args(),
47
+			'resolve'            => [$this, 'resolveConnection'],
48
+		];
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * @param $entity
54
-     * @param $args
55
-     * @param $context
56
-     * @param $info
57
-     * @return array
58
-     * @throws Exception
59
-     * @since $VID:$
60
-     */
61
-    public function resolveConnection($entity, $args, $context, $info)
62
-    {
63
-        $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info);
64
-        return $resolver->get_connection();
65
-    }
52
+	/**
53
+	 * @param $entity
54
+	 * @param $args
55
+	 * @param $context
56
+	 * @param $info
57
+	 * @return array
58
+	 * @throws Exception
59
+	 * @since $VID:$
60
+	 */
61
+	public function resolveConnection($entity, $args, $context, $info)
62
+	{
63
+		$resolver = new DatetimeConnectionResolver($entity, $args, $context, $info);
64
+		return $resolver->get_connection();
65
+	}
66 66
 
67
-    /**
68
-     * Given an optional array of args, this returns the args to be used in the connection
69
-     *
70
-     * @access public
71
-     * @param array $args The args to modify the defaults
72
-     *
73
-     * @return array
74
-     */
75
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
76
-    public static function get_connection_args($args = [])
77
-    {
78
-        $newArgs = [
79
-            'orderby'      => [
80
-                'type'        => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'],
81
-                'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
82
-            ],
83
-            'event'  => [
84
-                'type'        => 'ID',
85
-                'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'),
86
-            ],
87
-            'eventIn'  => [
88
-                'type'        => ['list_of' => 'ID'],
89
-                'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'),
90
-            ],
91
-            'eventId'  => [
92
-                'type'        => 'Int',
93
-                'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'),
94
-            ],
95
-            'eventIdIn'  => [
96
-                'type'        => ['list_of' => 'Int'],
97
-                'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'),
98
-            ],
99
-            'ticket' => [
100
-                'type'        => 'ID',
101
-                'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'),
102
-            ],
103
-            'ticketIn' => [
104
-                'type'        => ['list_of' => 'ID'],
105
-                'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'),
106
-            ],
107
-            'ticketId' => [
108
-                'type'        => 'Int',
109
-                'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'),
110
-            ],
111
-            'ticketIdIn' => [
112
-                'type'        => ['list_of' => 'Int'],
113
-                'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'),
114
-            ],
115
-            'upcoming' => [
116
-                'type'        => 'Boolean',
117
-                'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'),
118
-            ],
119
-            'active'   => [
120
-                'type'        => 'Boolean',
121
-                'description' => esc_html__('Datetimes which are active.', 'event_espresso'),
122
-            ],
123
-            'expired'  => [
124
-                'type'        => 'Boolean',
125
-                'description' => esc_html__('Datetimes which are expired.', 'event_espresso'),
126
-            ],
127
-        ];
67
+	/**
68
+	 * Given an optional array of args, this returns the args to be used in the connection
69
+	 *
70
+	 * @access public
71
+	 * @param array $args The args to modify the defaults
72
+	 *
73
+	 * @return array
74
+	 */
75
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
76
+	public static function get_connection_args($args = [])
77
+	{
78
+		$newArgs = [
79
+			'orderby'      => [
80
+				'type'        => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'],
81
+				'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
82
+			],
83
+			'event'  => [
84
+				'type'        => 'ID',
85
+				'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'),
86
+			],
87
+			'eventIn'  => [
88
+				'type'        => ['list_of' => 'ID'],
89
+				'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'),
90
+			],
91
+			'eventId'  => [
92
+				'type'        => 'Int',
93
+				'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'),
94
+			],
95
+			'eventIdIn'  => [
96
+				'type'        => ['list_of' => 'Int'],
97
+				'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'),
98
+			],
99
+			'ticket' => [
100
+				'type'        => 'ID',
101
+				'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'),
102
+			],
103
+			'ticketIn' => [
104
+				'type'        => ['list_of' => 'ID'],
105
+				'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'),
106
+			],
107
+			'ticketId' => [
108
+				'type'        => 'Int',
109
+				'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'),
110
+			],
111
+			'ticketIdIn' => [
112
+				'type'        => ['list_of' => 'Int'],
113
+				'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'),
114
+			],
115
+			'upcoming' => [
116
+				'type'        => 'Boolean',
117
+				'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'),
118
+			],
119
+			'active'   => [
120
+				'type'        => 'Boolean',
121
+				'description' => esc_html__('Datetimes which are active.', 'event_espresso'),
122
+			],
123
+			'expired'  => [
124
+				'type'        => 'Boolean',
125
+				'description' => esc_html__('Datetimes which are expired.', 'event_espresso'),
126
+			],
127
+		];
128 128
 
129
-        $newArgs = apply_filters(
130
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__datetime_args',
131
-            $newArgs,
132
-            $args
133
-        );
134
-        return array_merge(
135
-            $newArgs,
136
-            $args
137
-        );
138
-    }
129
+		$newArgs = apply_filters(
130
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__datetime_args',
131
+			$newArgs,
132
+			$args
133
+		);
134
+		return array_merge(
135
+			$newArgs,
136
+			$args
137
+		);
138
+	}
139 139
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/TicketPricesConnection.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -19,123 +19,123 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * TicketConnection constructor.
24
-     *
25
-     * @param EEM_Price $model
26
-     */
27
-    public function __construct(EEM_Price $model)
28
-    {
29
-        $this->model = $model;
30
-    }
22
+	/**
23
+	 * TicketConnection constructor.
24
+	 *
25
+	 * @param EEM_Price $model
26
+	 */
27
+	public function __construct(EEM_Price $model)
28
+	{
29
+		$this->model = $model;
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * @return array
35
-     * @since $VID:$
36
-     */
37
-    public function config()
38
-    {
39
-        return [
40
-            'fromType'           => $this->namespace . 'Ticket',
41
-            'toType'             => $this->namespace . 'Price',
42
-            'fromFieldName'      => 'prices',
43
-            'connectionTypeName' => "{$this->namespace}TicketPricesConnection",
44
-            'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45
-            'resolve'            => [$this, 'resolveConnection'],
46
-        ];
47
-    }
33
+	/**
34
+	 * @return array
35
+	 * @since $VID:$
36
+	 */
37
+	public function config()
38
+	{
39
+		return [
40
+			'fromType'           => $this->namespace . 'Ticket',
41
+			'toType'             => $this->namespace . 'Price',
42
+			'fromFieldName'      => 'prices',
43
+			'connectionTypeName' => "{$this->namespace}TicketPricesConnection",
44
+			'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45
+			'resolve'            => [$this, 'resolveConnection'],
46
+		];
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @param $entity
52
-     * @param $args
53
-     * @param $context
54
-     * @param $info
55
-     * @return array
56
-     * @throws Exception
57
-     * @since $VID:$
58
-     */
59
-    public function resolveConnection($entity, $args, $context, $info)
60
-    {
61
-        $resolver = new PriceConnectionResolver($entity, $args, $context, $info);
62
-        return $resolver->get_connection();
63
-    }
50
+	/**
51
+	 * @param $entity
52
+	 * @param $args
53
+	 * @param $context
54
+	 * @param $info
55
+	 * @return array
56
+	 * @throws Exception
57
+	 * @since $VID:$
58
+	 */
59
+	public function resolveConnection($entity, $args, $context, $info)
60
+	{
61
+		$resolver = new PriceConnectionResolver($entity, $args, $context, $info);
62
+		return $resolver->get_connection();
63
+	}
64 64
 
65
-    /**
66
-     * Given an optional array of args, this returns the args to be used in the connection
67
-     *
68
-     * @access public
69
-     * @param array $args The args to modify the defaults
70
-     *
71
-     * @return array
72
-     */
73
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
74
-    public static function get_connection_args($args = [])
75
-    {
76
-        $newArgs = [
77
-            'in'              => [
78
-                'type'        => ['list_of' => 'ID'],
79
-                'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'),
80
-            ],
81
-            'idIn'            => [
82
-                'type'        => ['list_of' => 'ID'],
83
-                'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'),
84
-            ],
85
-            'includeDefaultPrices'  => [
86
-                'type'        => 'Boolean',
87
-                'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'),
88
-            ],
89
-            'ticket'          => [
90
-                'type'        => 'ID',
91
-                'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'),
92
-            ],
93
-            'ticketIn'        => [
94
-                'type'        => ['list_of' => 'ID'],
95
-                'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'),
96
-            ],
97
-            'ticketId'        => [
98
-                'type'        => 'Int',
99
-                'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'),
100
-            ],
101
-            'ticketIdIn'      => [
102
-                'type'        => ['list_of' => 'Int'],
103
-                'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'),
104
-            ],
105
-            'priceType'       => [
106
-                'type'        => 'ID',
107
-                'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'),
108
-            ],
109
-            'priceTypeIn'     => [
110
-                'type'        => ['list_of' => 'ID'],
111
-                'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'),
112
-            ],
113
-            'priceTypeId'     => [
114
-                'type'        => 'Int',
115
-                'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'),
116
-            ],
117
-            'priceTypeIdIn'   => [
118
-                'type'        => ['list_of' => 'Int'],
119
-                'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'),
120
-            ],
121
-            'priceBaseType'   => [
122
-                'type'        => 'PriceBaseTypeEnum',
123
-                'description' => esc_html__('Price Base type.', 'event_espresso'),
124
-            ],
125
-            'priceBaseTypeIn' => [
126
-                'type'        => ['list_of' => 'PriceBaseTypeEnum'],
127
-                'description' => esc_html__('Price Base types.', 'event_espresso'),
128
-            ],
129
-        ];
65
+	/**
66
+	 * Given an optional array of args, this returns the args to be used in the connection
67
+	 *
68
+	 * @access public
69
+	 * @param array $args The args to modify the defaults
70
+	 *
71
+	 * @return array
72
+	 */
73
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
74
+	public static function get_connection_args($args = [])
75
+	{
76
+		$newArgs = [
77
+			'in'              => [
78
+				'type'        => ['list_of' => 'ID'],
79
+				'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'),
80
+			],
81
+			'idIn'            => [
82
+				'type'        => ['list_of' => 'ID'],
83
+				'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'),
84
+			],
85
+			'includeDefaultPrices'  => [
86
+				'type'        => 'Boolean',
87
+				'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'),
88
+			],
89
+			'ticket'          => [
90
+				'type'        => 'ID',
91
+				'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'),
92
+			],
93
+			'ticketIn'        => [
94
+				'type'        => ['list_of' => 'ID'],
95
+				'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'),
96
+			],
97
+			'ticketId'        => [
98
+				'type'        => 'Int',
99
+				'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'),
100
+			],
101
+			'ticketIdIn'      => [
102
+				'type'        => ['list_of' => 'Int'],
103
+				'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'),
104
+			],
105
+			'priceType'       => [
106
+				'type'        => 'ID',
107
+				'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'),
108
+			],
109
+			'priceTypeIn'     => [
110
+				'type'        => ['list_of' => 'ID'],
111
+				'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'),
112
+			],
113
+			'priceTypeId'     => [
114
+				'type'        => 'Int',
115
+				'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'),
116
+			],
117
+			'priceTypeIdIn'   => [
118
+				'type'        => ['list_of' => 'Int'],
119
+				'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'),
120
+			],
121
+			'priceBaseType'   => [
122
+				'type'        => 'PriceBaseTypeEnum',
123
+				'description' => esc_html__('Price Base type.', 'event_espresso'),
124
+			],
125
+			'priceBaseTypeIn' => [
126
+				'type'        => ['list_of' => 'PriceBaseTypeEnum'],
127
+				'description' => esc_html__('Price Base types.', 'event_espresso'),
128
+			],
129
+		];
130 130
 
131
-        $newArgs = apply_filters(
132
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args',
133
-            $newArgs,
134
-            $args
135
-        );
136
-        return array_merge(
137
-            $newArgs,
138
-            $args
139
-        );
140
-    }
131
+		$newArgs = apply_filters(
132
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args',
133
+			$newArgs,
134
+			$args
135
+		);
136
+		return array_merge(
137
+			$newArgs,
138
+			$args
139
+		);
140
+	}
141 141
 }
Please login to merge, or discard this patch.
services/graphql/connection_resolvers/PriceTypeConnectionResolver.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -14,80 +14,80 @@
 block discarded – undo
14 14
  */
15 15
 class PriceTypeConnectionResolver extends AbstractConnectionResolver
16 16
 {
17
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
18
-    public function get_loader_name()
19
-    {
20
-        return 'espresso_priceType';
21
-    }
17
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
18
+	public function get_loader_name()
19
+	{
20
+		return 'espresso_priceType';
21
+	}
22 22
 
23
-    /**
24
-     * @return EEM_Price_Type
25
-     * @throws EE_Error
26
-     * @throws InvalidArgumentException
27
-     * @throws InvalidDataTypeException
28
-     * @throws InvalidInterfaceException
29
-     */
30
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
31
-    public function get_query()
32
-    {
33
-        return EEM_Price_Type::instance();
34
-    }
23
+	/**
24
+	 * @return EEM_Price_Type
25
+	 * @throws EE_Error
26
+	 * @throws InvalidArgumentException
27
+	 * @throws InvalidDataTypeException
28
+	 * @throws InvalidInterfaceException
29
+	 */
30
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
31
+	public function get_query()
32
+	{
33
+		return EEM_Price_Type::instance();
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * Return an array of item IDs from the query
39
-     *
40
-     * @return array
41
-     */
42
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
43
-    public function get_ids()
44
-    {
45
-        $results = $this->query->get_col($this->query_args);
37
+	/**
38
+	 * Return an array of item IDs from the query
39
+	 *
40
+	 * @return array
41
+	 */
42
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
43
+	public function get_ids()
44
+	{
45
+		$results = $this->query->get_col($this->query_args);
46 46
 
47
-        return ! empty($results) ? $results : [];
48
-    }
47
+		return ! empty($results) ? $results : [];
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * Here, we map the args from the input, then we make sure that we're only querying
53
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
54
-     * handle batch resolution of the posts.
55
-     *
56
-     * @return array
57
-     * @throws EE_Error
58
-     * @throws InvalidArgumentException
59
-     * @throws ReflectionException
60
-     * @throws InvalidDataTypeException
61
-     * @throws InvalidInterfaceException
62
-     */
63
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
64
-    public function get_query_args()
65
-    {
66
-        $where_params = [];
67
-        $query_args   = [];
51
+	/**
52
+	 * Here, we map the args from the input, then we make sure that we're only querying
53
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
54
+	 * handle batch resolution of the posts.
55
+	 *
56
+	 * @return array
57
+	 * @throws EE_Error
58
+	 * @throws InvalidArgumentException
59
+	 * @throws ReflectionException
60
+	 * @throws InvalidDataTypeException
61
+	 * @throws InvalidInterfaceException
62
+	 */
63
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
64
+	public function get_query_args()
65
+	{
66
+		$where_params = [];
67
+		$query_args   = [];
68 68
 
69
-        $query_args['limit'] = $this->getLimit();
69
+		$query_args['limit'] = $this->getLimit();
70 70
 
71
-        // Avoid multiple entries by join.
72
-        $query_args['group_by'] = 'PRT_ID';
71
+		// Avoid multiple entries by join.
72
+		$query_args['group_by'] = 'PRT_ID';
73 73
 
74
-        $where_params = apply_filters(
75
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__priceType_where_params',
76
-            $where_params,
77
-            $this->source,
78
-            $this->args
79
-        );
74
+		$where_params = apply_filters(
75
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__priceType_where_params',
76
+			$where_params,
77
+			$this->source,
78
+			$this->args
79
+		);
80 80
 
81
-        $query_args[] = $where_params;
81
+		$query_args[] = $where_params;
82 82
 
83
-        /**
84
-         * Return the $query_args
85
-         */
86
-        return apply_filters(
87
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__priceType_query_args',
88
-            $query_args,
89
-            $this->source,
90
-            $this->args
91
-        );
92
-    }
83
+		/**
84
+		 * Return the $query_args
85
+		 */
86
+		return apply_filters(
87
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__priceType_query_args',
88
+			$query_args,
89
+			$this->source,
90
+			$this->args
91
+		);
92
+	}
93 93
 }
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/PriceConnectionResolver.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -15,173 +15,173 @@
 block discarded – undo
15 15
  */
16 16
 class PriceConnectionResolver extends AbstractConnectionResolver
17 17
 {
18
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
19
-    public function get_loader_name()
20
-    {
21
-        return 'espresso_price';
22
-    }
23
-
24
-    /**
25
-     * @return EEM_Price
26
-     * @throws EE_Error
27
-     * @throws InvalidArgumentException
28
-     * @throws InvalidDataTypeException
29
-     * @throws InvalidInterfaceException
30
-     */
31
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
32
-    public function get_query()
33
-    {
34
-        return EEM_Price::instance();
35
-    }
36
-
37
-
38
-    /**
39
-     * Return an array of item IDs from the query
40
-     *
41
-     * @return array
42
-     */
43
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
44
-    public function get_ids()
45
-    {
46
-        $results = $this->query->get_col($this->query_args);
47
-
48
-        return ! empty($results) ? $results : [];
49
-    }
50
-
51
-
52
-    /**
53
-     * Here, we map the args from the input, then we make sure that we're only querying
54
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
55
-     * handle batch resolution of the posts.
56
-     *
57
-     * @return array
58
-     * @throws EE_Error
59
-     * @throws InvalidArgumentException
60
-     * @throws ReflectionException
61
-     * @throws InvalidDataTypeException
62
-     * @throws InvalidInterfaceException
63
-     */
64
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
65
-    public function get_query_args()
66
-    {
67
-        $where_params = [];
68
-        $query_args   = [];
69
-
70
-        $query_args['limit'] = $this->getLimit();
71
-
72
-        // Avoid multiple entries by join.
73
-        $query_args['group_by'] = 'PRC_ID';
74
-
75
-        $query_args['default_where_conditions'] = 'minimum';
76
-
77
-        /**
78
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
79
-         */
80
-        $input_fields = [];
81
-        if (! empty($this->args['where'])) {
82
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
83
-
84
-            // Use the proper operator.
85
-            if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
86
-                $input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
87
-            }
88
-            if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
89
-                $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
90
-            }
91
-            if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
92
-                $input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
93
-            }
94
-            if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
95
-                $input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
96
-            }
97
-        }
98
-
99
-        /**
100
-         * Determine where we're at in the Graph and adjust the query context appropriately.
101
-         */
102
-        if ($this->source instanceof EE_Ticket) {
103
-            $where_params['Ticket.TKT_ID'] = $this->source->ID();
104
-        }
105
-
106
-        /**
107
-         * Merge the input_fields with the default query_args
108
-         */
109
-        if (! empty($input_fields)) {
110
-            $where_params = array_merge($where_params, $input_fields);
111
-        }
112
-
113
-        list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
114
-
115
-        // If default prices should be included.
116
-        if (! empty($this->args['where']['includeDefaultPrices'])) {
117
-            /**
118
-             * We need to get each price that
119
-             * - satisfies $where_params above
120
-             * OR
121
-             * - it's a default non trashed price
122
-             */
123
-            $where_params = [
124
-                'OR' => [
125
-                    // use extra OR instead of AND to avoid it getting overridden
126
-                    'OR' => [
127
-                        'AND' => [
128
-                            'PRC_deleted'    => 0,
129
-                            'PRC_is_default' => 1,
130
-                        ]
131
-                    ],
132
-                    'AND' => $where_params,
133
-                ],
134
-            ];
135
-        }
136
-
137
-        $where_params = apply_filters(
138
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
139
-            $where_params,
140
-            $this->source,
141
-            $this->args
142
-        );
143
-
144
-        $query_args[] = $where_params;
145
-
146
-        /**
147
-         * Return the $query_args
148
-         */
149
-        return apply_filters(
150
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
151
-            $query_args,
152
-            $this->source,
153
-            $this->args
154
-        );
155
-    }
156
-
157
-
158
-    /**
159
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
160
-     * friendly keys.
161
-     *
162
-     * @param array $where_args
163
-     * @return array
164
-     */
165
-    public function sanitizeInputFields(array $where_args)
166
-    {
167
-        $arg_mapping = [
168
-            'in'              => 'PRC_ID',
169
-            'idIn'            => 'PRC_ID',
170
-            'ticket'          => 'Ticket.TKT_ID',
171
-            'ticketIn'        => 'Ticket.TKT_ID',
172
-            'ticketIdIn'      => 'Ticket.TKT_ID',
173
-            'ticketId'        => 'Ticket.TKT_ID', // priority.
174
-            'priceType'       => 'Price_Type.PRT_ID',
175
-            'priceTypeIn'     => 'Price_Type.PRT_ID',
176
-            'priceTypeIdIn'   => 'Price_Type.PRT_ID',
177
-            'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
178
-            'priceBaseType'   => 'Price_Type.PBT_ID',
179
-            'priceBaseTypeIn' => 'Price_Type.PBT_ID',
180
-        ];
181
-        return $this->sanitizeWhereArgsForInputFields(
182
-            $where_args,
183
-            $arg_mapping,
184
-            ['in', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
185
-        );
186
-    }
18
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
19
+	public function get_loader_name()
20
+	{
21
+		return 'espresso_price';
22
+	}
23
+
24
+	/**
25
+	 * @return EEM_Price
26
+	 * @throws EE_Error
27
+	 * @throws InvalidArgumentException
28
+	 * @throws InvalidDataTypeException
29
+	 * @throws InvalidInterfaceException
30
+	 */
31
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
32
+	public function get_query()
33
+	{
34
+		return EEM_Price::instance();
35
+	}
36
+
37
+
38
+	/**
39
+	 * Return an array of item IDs from the query
40
+	 *
41
+	 * @return array
42
+	 */
43
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
44
+	public function get_ids()
45
+	{
46
+		$results = $this->query->get_col($this->query_args);
47
+
48
+		return ! empty($results) ? $results : [];
49
+	}
50
+
51
+
52
+	/**
53
+	 * Here, we map the args from the input, then we make sure that we're only querying
54
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
55
+	 * handle batch resolution of the posts.
56
+	 *
57
+	 * @return array
58
+	 * @throws EE_Error
59
+	 * @throws InvalidArgumentException
60
+	 * @throws ReflectionException
61
+	 * @throws InvalidDataTypeException
62
+	 * @throws InvalidInterfaceException
63
+	 */
64
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
65
+	public function get_query_args()
66
+	{
67
+		$where_params = [];
68
+		$query_args   = [];
69
+
70
+		$query_args['limit'] = $this->getLimit();
71
+
72
+		// Avoid multiple entries by join.
73
+		$query_args['group_by'] = 'PRC_ID';
74
+
75
+		$query_args['default_where_conditions'] = 'minimum';
76
+
77
+		/**
78
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
79
+		 */
80
+		$input_fields = [];
81
+		if (! empty($this->args['where'])) {
82
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
83
+
84
+			// Use the proper operator.
85
+			if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
86
+				$input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
87
+			}
88
+			if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
89
+				$input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
90
+			}
91
+			if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
92
+				$input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
93
+			}
94
+			if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
95
+				$input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
96
+			}
97
+		}
98
+
99
+		/**
100
+		 * Determine where we're at in the Graph and adjust the query context appropriately.
101
+		 */
102
+		if ($this->source instanceof EE_Ticket) {
103
+			$where_params['Ticket.TKT_ID'] = $this->source->ID();
104
+		}
105
+
106
+		/**
107
+		 * Merge the input_fields with the default query_args
108
+		 */
109
+		if (! empty($input_fields)) {
110
+			$where_params = array_merge($where_params, $input_fields);
111
+		}
112
+
113
+		list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
114
+
115
+		// If default prices should be included.
116
+		if (! empty($this->args['where']['includeDefaultPrices'])) {
117
+			/**
118
+			 * We need to get each price that
119
+			 * - satisfies $where_params above
120
+			 * OR
121
+			 * - it's a default non trashed price
122
+			 */
123
+			$where_params = [
124
+				'OR' => [
125
+					// use extra OR instead of AND to avoid it getting overridden
126
+					'OR' => [
127
+						'AND' => [
128
+							'PRC_deleted'    => 0,
129
+							'PRC_is_default' => 1,
130
+						]
131
+					],
132
+					'AND' => $where_params,
133
+				],
134
+			];
135
+		}
136
+
137
+		$where_params = apply_filters(
138
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
139
+			$where_params,
140
+			$this->source,
141
+			$this->args
142
+		);
143
+
144
+		$query_args[] = $where_params;
145
+
146
+		/**
147
+		 * Return the $query_args
148
+		 */
149
+		return apply_filters(
150
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
151
+			$query_args,
152
+			$this->source,
153
+			$this->args
154
+		);
155
+	}
156
+
157
+
158
+	/**
159
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
160
+	 * friendly keys.
161
+	 *
162
+	 * @param array $where_args
163
+	 * @return array
164
+	 */
165
+	public function sanitizeInputFields(array $where_args)
166
+	{
167
+		$arg_mapping = [
168
+			'in'              => 'PRC_ID',
169
+			'idIn'            => 'PRC_ID',
170
+			'ticket'          => 'Ticket.TKT_ID',
171
+			'ticketIn'        => 'Ticket.TKT_ID',
172
+			'ticketIdIn'      => 'Ticket.TKT_ID',
173
+			'ticketId'        => 'Ticket.TKT_ID', // priority.
174
+			'priceType'       => 'Price_Type.PRT_ID',
175
+			'priceTypeIn'     => 'Price_Type.PRT_ID',
176
+			'priceTypeIdIn'   => 'Price_Type.PRT_ID',
177
+			'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
178
+			'priceBaseType'   => 'Price_Type.PBT_ID',
179
+			'priceBaseTypeIn' => 'Price_Type.PBT_ID',
180
+		];
181
+		return $this->sanitizeWhereArgsForInputFields(
182
+			$where_args,
183
+			$arg_mapping,
184
+			['in', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
185
+		);
186
+	}
187 187
 }
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/AttendeeConnectionResolver.php 1 patch
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -16,167 +16,167 @@
 block discarded – undo
16 16
  */
17 17
 class AttendeeConnectionResolver extends AbstractConnectionResolver
18 18
 {
19
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
20
-    public function get_loader_name()
21
-    {
22
-        return 'espresso_attendee';
23
-    }
24
-
25
-    /**
26
-     * @return EEM_Attendee
27
-     * @throws EE_Error
28
-     * @throws InvalidArgumentException
29
-     * @throws InvalidDataTypeException
30
-     * @throws InvalidInterfaceException
31
-     */
32
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
33
-    public function get_query()
34
-    {
35
-        return EEM_Attendee::instance();
36
-    }
37
-
38
-
39
-    /**
40
-     * Return an array of item IDs from the query
41
-     *
42
-     * @return array
43
-     */
44
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
45
-    public function get_ids()
46
-    {
47
-        $results = $this->query->get_col($this->query_args);
48
-
49
-        return ! empty($results) ? $results : [];
50
-    }
51
-
52
-
53
-    /**
54
-     * Here, we map the args from the input, then we make sure that we're only querying
55
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
56
-     * handle batch resolution of the posts.
57
-     *
58
-     * @return array
59
-     * @throws EE_Error
60
-     * @throws InvalidArgumentException
61
-     * @throws ReflectionException
62
-     * @throws InvalidDataTypeException
63
-     * @throws InvalidInterfaceException
64
-     */
65
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
66
-    public function get_query_args()
67
-    {
68
-        $where_params = [];
69
-        $query_args   = [];
70
-
71
-        $query_args['limit'] = $this->getLimit();
72
-
73
-        // Avoid multiple entries by join.
74
-        $query_args['group_by'] = 'ATT_ID';
75
-
76
-        $query_args['default_where_conditions'] = 'minimum';
77
-
78
-        /**
79
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
80
-         */
81
-        $input_fields = [];
82
-        if (! empty($this->args['where'])) {
83
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
84
-
85
-            // Since we do not have any falsy values in query params
86
-            // Lets get rid of empty values
87
-            $input_fields = array_filter($input_fields);
88
-
89
-            // Use the proper operator.
90
-            if (! empty($input_fields['Registration.Event.EVT_ID']) && is_array($input_fields['Registration.Event.EVT_ID'])) {
91
-                $input_fields['Registration.Event.EVT_ID'] = ['IN', $input_fields['Registration.Event.EVT_ID']];
92
-            }
93
-            if (! empty($input_fields['Registration.Ticket.TKT_ID']) && is_array($input_fields['Registration.Ticket.TKT_ID'])) {
94
-                $input_fields['Registration.Ticket.TKT_ID'] = ['IN', $input_fields['Registration.Ticket.TKT_ID']];
95
-            }
96
-            // If Ticket param is passed, it will have preference over Datetime param
97
-            // So, use Datetime param only if a Ticket param is not passed
98
-            if (! empty($input_fields['Datetime.DTT_ID']) && empty($input_fields['Registration.Ticket.TKT_ID'])) {
99
-                $datetimeIds = $input_fields['Datetime.DTT_ID'];
100
-                // Make sure it's an array, ready for "IN" operator
101
-                $datetimeIds = is_array($datetimeIds) ? $datetimeIds : [$datetimeIds];
102
-
103
-                try {
104
-                    // Get related ticket IDs for the given dates
105
-                    $ticketIds = EEM_Ticket::instance()->get_col([
106
-                        [
107
-                            'Datetime.DTT_ID' => ['IN', $datetimeIds],
108
-                            'TKT_deleted'     => ['IN', [true, false]],
109
-                        ],
110
-                        'default_where_conditions' => 'minimum',
111
-                    ]);
112
-                } catch (Throwable $th) {
113
-                    $ticketIds = [];
114
-                }
115
-
116
-                if (!empty($ticketIds)) {
117
-                    $input_fields['Registration.Ticket.TKT_ID'] = ['IN', $ticketIds];
118
-                }
119
-            }
120
-            // Since there is no relation between Attendee and Datetime, we need to remove it
121
-            unset($input_fields['Datetime.DTT_ID']);
122
-        }
123
-
124
-        /**
125
-         * Merge the input_fields with the default query_args
126
-         */
127
-        if (! empty($input_fields)) {
128
-            $where_params = array_merge($where_params, $input_fields);
129
-        }
130
-
131
-        list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'ATT_ID');
132
-
133
-        $where_params = apply_filters(
134
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__attendee_where_params',
135
-            $where_params,
136
-            $this->source,
137
-            $this->args
138
-        );
139
-
140
-        $query_args[] = $where_params;
141
-
142
-        /**
143
-         * Return the $query_args
144
-         */
145
-        return apply_filters(
146
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__attendee_query_args',
147
-            $query_args,
148
-            $this->source,
149
-            $this->args
150
-        );
151
-    }
152
-
153
-
154
-    /**
155
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
156
-     * friendly keys.
157
-     *
158
-     * @param array $where_args
159
-     * @return array
160
-     */
161
-    public function sanitizeInputFields(array $where_args)
162
-    {
163
-        $arg_mapping = [
164
-            // There is no direct relation between Attendee and Datetime
165
-            // But we will handle it via Tickets related to given dates
166
-            'datetime'      => 'Datetime.DTT_ID',
167
-            'datetimeIn'    => 'Datetime.DTT_ID',
168
-            'event'         => 'Registration.Event.EVT_ID',
169
-            'eventIn'       => 'Registration.Event.EVT_ID',
170
-            'regTicket'     => 'Registration.Ticket.TKT_ID',
171
-            'regTicketIn'   => 'Registration.Ticket.TKT_ID',
172
-            'regTicketIdIn' => 'Registration.Ticket.TKT_ID',
173
-            'regTicketId'   => 'Registration.Ticket.TKT_ID', // priority.
174
-            'regStatus'     => 'Registration.Status.STS_ID',
175
-        ];
176
-        return $this->sanitizeWhereArgsForInputFields(
177
-            $where_args,
178
-            $arg_mapping,
179
-            ['datetime', 'datetimeIn', 'event', 'eventIn', 'regTicket', 'regTicketIn']
180
-        );
181
-    }
19
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
20
+	public function get_loader_name()
21
+	{
22
+		return 'espresso_attendee';
23
+	}
24
+
25
+	/**
26
+	 * @return EEM_Attendee
27
+	 * @throws EE_Error
28
+	 * @throws InvalidArgumentException
29
+	 * @throws InvalidDataTypeException
30
+	 * @throws InvalidInterfaceException
31
+	 */
32
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
33
+	public function get_query()
34
+	{
35
+		return EEM_Attendee::instance();
36
+	}
37
+
38
+
39
+	/**
40
+	 * Return an array of item IDs from the query
41
+	 *
42
+	 * @return array
43
+	 */
44
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
45
+	public function get_ids()
46
+	{
47
+		$results = $this->query->get_col($this->query_args);
48
+
49
+		return ! empty($results) ? $results : [];
50
+	}
51
+
52
+
53
+	/**
54
+	 * Here, we map the args from the input, then we make sure that we're only querying
55
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
56
+	 * handle batch resolution of the posts.
57
+	 *
58
+	 * @return array
59
+	 * @throws EE_Error
60
+	 * @throws InvalidArgumentException
61
+	 * @throws ReflectionException
62
+	 * @throws InvalidDataTypeException
63
+	 * @throws InvalidInterfaceException
64
+	 */
65
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
66
+	public function get_query_args()
67
+	{
68
+		$where_params = [];
69
+		$query_args   = [];
70
+
71
+		$query_args['limit'] = $this->getLimit();
72
+
73
+		// Avoid multiple entries by join.
74
+		$query_args['group_by'] = 'ATT_ID';
75
+
76
+		$query_args['default_where_conditions'] = 'minimum';
77
+
78
+		/**
79
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
80
+		 */
81
+		$input_fields = [];
82
+		if (! empty($this->args['where'])) {
83
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
84
+
85
+			// Since we do not have any falsy values in query params
86
+			// Lets get rid of empty values
87
+			$input_fields = array_filter($input_fields);
88
+
89
+			// Use the proper operator.
90
+			if (! empty($input_fields['Registration.Event.EVT_ID']) && is_array($input_fields['Registration.Event.EVT_ID'])) {
91
+				$input_fields['Registration.Event.EVT_ID'] = ['IN', $input_fields['Registration.Event.EVT_ID']];
92
+			}
93
+			if (! empty($input_fields['Registration.Ticket.TKT_ID']) && is_array($input_fields['Registration.Ticket.TKT_ID'])) {
94
+				$input_fields['Registration.Ticket.TKT_ID'] = ['IN', $input_fields['Registration.Ticket.TKT_ID']];
95
+			}
96
+			// If Ticket param is passed, it will have preference over Datetime param
97
+			// So, use Datetime param only if a Ticket param is not passed
98
+			if (! empty($input_fields['Datetime.DTT_ID']) && empty($input_fields['Registration.Ticket.TKT_ID'])) {
99
+				$datetimeIds = $input_fields['Datetime.DTT_ID'];
100
+				// Make sure it's an array, ready for "IN" operator
101
+				$datetimeIds = is_array($datetimeIds) ? $datetimeIds : [$datetimeIds];
102
+
103
+				try {
104
+					// Get related ticket IDs for the given dates
105
+					$ticketIds = EEM_Ticket::instance()->get_col([
106
+						[
107
+							'Datetime.DTT_ID' => ['IN', $datetimeIds],
108
+							'TKT_deleted'     => ['IN', [true, false]],
109
+						],
110
+						'default_where_conditions' => 'minimum',
111
+					]);
112
+				} catch (Throwable $th) {
113
+					$ticketIds = [];
114
+				}
115
+
116
+				if (!empty($ticketIds)) {
117
+					$input_fields['Registration.Ticket.TKT_ID'] = ['IN', $ticketIds];
118
+				}
119
+			}
120
+			// Since there is no relation between Attendee and Datetime, we need to remove it
121
+			unset($input_fields['Datetime.DTT_ID']);
122
+		}
123
+
124
+		/**
125
+		 * Merge the input_fields with the default query_args
126
+		 */
127
+		if (! empty($input_fields)) {
128
+			$where_params = array_merge($where_params, $input_fields);
129
+		}
130
+
131
+		list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'ATT_ID');
132
+
133
+		$where_params = apply_filters(
134
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__attendee_where_params',
135
+			$where_params,
136
+			$this->source,
137
+			$this->args
138
+		);
139
+
140
+		$query_args[] = $where_params;
141
+
142
+		/**
143
+		 * Return the $query_args
144
+		 */
145
+		return apply_filters(
146
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__attendee_query_args',
147
+			$query_args,
148
+			$this->source,
149
+			$this->args
150
+		);
151
+	}
152
+
153
+
154
+	/**
155
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
156
+	 * friendly keys.
157
+	 *
158
+	 * @param array $where_args
159
+	 * @return array
160
+	 */
161
+	public function sanitizeInputFields(array $where_args)
162
+	{
163
+		$arg_mapping = [
164
+			// There is no direct relation between Attendee and Datetime
165
+			// But we will handle it via Tickets related to given dates
166
+			'datetime'      => 'Datetime.DTT_ID',
167
+			'datetimeIn'    => 'Datetime.DTT_ID',
168
+			'event'         => 'Registration.Event.EVT_ID',
169
+			'eventIn'       => 'Registration.Event.EVT_ID',
170
+			'regTicket'     => 'Registration.Ticket.TKT_ID',
171
+			'regTicketIn'   => 'Registration.Ticket.TKT_ID',
172
+			'regTicketIdIn' => 'Registration.Ticket.TKT_ID',
173
+			'regTicketId'   => 'Registration.Ticket.TKT_ID', // priority.
174
+			'regStatus'     => 'Registration.Status.STS_ID',
175
+		];
176
+		return $this->sanitizeWhereArgsForInputFields(
177
+			$where_args,
178
+			$arg_mapping,
179
+			['datetime', 'datetimeIn', 'event', 'eventIn', 'regTicket', 'regTicketIn']
180
+		);
181
+	}
182 182
 }
Please login to merge, or discard this patch.