Completed
Branch event-default-reg-status (41cd2c)
by
unknown
09:13
created
core/domain/services/graphql/data/mutations/EventMutation.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -15,87 +15,87 @@
 block discarded – undo
15 15
 class EventMutation
16 16
 {
17 17
 
18
-    /**
19
-     * Maps the GraphQL input to a format that the model functions can use
20
-     *
21
-     * @param array  $input         Data coming from the GraphQL mutation query input
22
-     * @param string $mutation_name Name of the mutation being performed
23
-     * @return array
24
-     * @throws Exception
25
-     */
26
-    public static function prepareFields(array $input, string $mutation_name): array
27
-    {
28
-        $args = [];
29
-
30
-        if (array_key_exists('allowDonations', $input)) {
31
-            $args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN);
32
-        }
33
-
34
-        if (array_key_exists('allowOverflow', $input)) {
35
-            $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN);
36
-        }
37
-
38
-        if (! empty($input['altRegPage'])) {
39
-            $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
40
-        }
41
-
42
-        if (! empty($input['defaultRegStatus'])) {
43
-            $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
44
-        }
45
-
46
-        if (! empty($input['description'])) {
47
-            $args['EVT_desc'] = wp_kses_post($input['description']);
48
-        }
49
-
50
-        if (array_key_exists('displayDescription', $input)) {
51
-            $args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN);
52
-        }
53
-
54
-        if (array_key_exists('displayTicketSelector', $input)) {
55
-            $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
56
-        }
57
-
58
-        if (! empty($input['maxRegistrations'])) {
59
-            $args['EVT_additional_limit'] = absint($input['maxRegistrations']);
60
-        }
61
-
62
-        if (array_key_exists('memberOnly', $input)) {
63
-            $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
64
-        }
65
-
66
-        if (! empty($input['name'])) {
67
-            $args['EVT_name'] = sanitize_text_field($input['name']);
68
-        }
69
-
70
-        if (! empty($input['order'])) {
71
-            $args['EVT_order'] = absint($input['order']);
72
-        }
73
-
74
-        if (! empty($input['phoneNumber'])) {
75
-            $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']);
76
-        }
77
-
78
-        if (! empty($input['shortDescription'])) {
79
-            $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db');
80
-        }
81
-
82
-        if (! empty($input['timezoneString'])) {
83
-            $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
84
-        }
85
-
86
-        if (! empty($input['visibleOn'])) {
87
-            $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn']));
88
-        }
89
-
90
-        if (! empty($input['manager'])) {
91
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
92
-            $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
93
-        }
94
-
95
-        return apply_filters(
96
-            'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args',
97
-            $args,
98
-            $input
99
-        );
100
-    }
18
+	/**
19
+	 * Maps the GraphQL input to a format that the model functions can use
20
+	 *
21
+	 * @param array  $input         Data coming from the GraphQL mutation query input
22
+	 * @param string $mutation_name Name of the mutation being performed
23
+	 * @return array
24
+	 * @throws Exception
25
+	 */
26
+	public static function prepareFields(array $input, string $mutation_name): array
27
+	{
28
+		$args = [];
29
+
30
+		if (array_key_exists('allowDonations', $input)) {
31
+			$args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN);
32
+		}
33
+
34
+		if (array_key_exists('allowOverflow', $input)) {
35
+			$args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN);
36
+		}
37
+
38
+		if (! empty($input['altRegPage'])) {
39
+			$args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
40
+		}
41
+
42
+		if (! empty($input['defaultRegStatus'])) {
43
+			$args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
44
+		}
45
+
46
+		if (! empty($input['description'])) {
47
+			$args['EVT_desc'] = wp_kses_post($input['description']);
48
+		}
49
+
50
+		if (array_key_exists('displayDescription', $input)) {
51
+			$args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN);
52
+		}
53
+
54
+		if (array_key_exists('displayTicketSelector', $input)) {
55
+			$args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
56
+		}
57
+
58
+		if (! empty($input['maxRegistrations'])) {
59
+			$args['EVT_additional_limit'] = absint($input['maxRegistrations']);
60
+		}
61
+
62
+		if (array_key_exists('memberOnly', $input)) {
63
+			$args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
64
+		}
65
+
66
+		if (! empty($input['name'])) {
67
+			$args['EVT_name'] = sanitize_text_field($input['name']);
68
+		}
69
+
70
+		if (! empty($input['order'])) {
71
+			$args['EVT_order'] = absint($input['order']);
72
+		}
73
+
74
+		if (! empty($input['phoneNumber'])) {
75
+			$args['EVT_phone'] = sanitize_text_field($input['phoneNumber']);
76
+		}
77
+
78
+		if (! empty($input['shortDescription'])) {
79
+			$args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db');
80
+		}
81
+
82
+		if (! empty($input['timezoneString'])) {
83
+			$args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
84
+		}
85
+
86
+		if (! empty($input['visibleOn'])) {
87
+			$args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn']));
88
+		}
89
+
90
+		if (! empty($input['manager'])) {
91
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
92
+			$args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
93
+		}
94
+
95
+		return apply_filters(
96
+			'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args',
97
+			$args,
98
+			$input
99
+		);
100
+	}
101 101
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
             $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN);
36 36
         }
37 37
 
38
-        if (! empty($input['altRegPage'])) {
38
+        if ( ! empty($input['altRegPage'])) {
39 39
             $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
40 40
         }
41 41
 
42
-        if (! empty($input['defaultRegStatus'])) {
42
+        if ( ! empty($input['defaultRegStatus'])) {
43 43
             $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
44 44
         }
45 45
 
46
-        if (! empty($input['description'])) {
46
+        if ( ! empty($input['description'])) {
47 47
             $args['EVT_desc'] = wp_kses_post($input['description']);
48 48
         }
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
56 56
         }
57 57
 
58
-        if (! empty($input['maxRegistrations'])) {
58
+        if ( ! empty($input['maxRegistrations'])) {
59 59
             $args['EVT_additional_limit'] = absint($input['maxRegistrations']);
60 60
         }
61 61
 
@@ -63,31 +63,31 @@  discard block
 block discarded – undo
63 63
             $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
64 64
         }
65 65
 
66
-        if (! empty($input['name'])) {
66
+        if ( ! empty($input['name'])) {
67 67
             $args['EVT_name'] = sanitize_text_field($input['name']);
68 68
         }
69 69
 
70
-        if (! empty($input['order'])) {
70
+        if ( ! empty($input['order'])) {
71 71
             $args['EVT_order'] = absint($input['order']);
72 72
         }
73 73
 
74
-        if (! empty($input['phoneNumber'])) {
74
+        if ( ! empty($input['phoneNumber'])) {
75 75
             $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']);
76 76
         }
77 77
 
78
-        if (! empty($input['shortDescription'])) {
78
+        if ( ! empty($input['shortDescription'])) {
79 79
             $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db');
80 80
         }
81 81
 
82
-        if (! empty($input['timezoneString'])) {
82
+        if ( ! empty($input['timezoneString'])) {
83 83
             $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
84 84
         }
85 85
 
86
-        if (! empty($input['visibleOn'])) {
86
+        if ( ! empty($input['visibleOn'])) {
87 87
             $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn']));
88 88
         }
89 89
 
90
-        if (! empty($input['manager'])) {
90
+        if ( ! empty($input['manager'])) {
91 91
             $parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
92 92
             $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
93 93
         }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/DatetimeMutation.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -21,106 +21,106 @@
 block discarded – undo
21 21
 class DatetimeMutation
22 22
 {
23 23
 
24
-    /**
25
-     * Maps the GraphQL input to a format that the model functions can use
26
-     *
27
-     * @param array $input Data coming from the GraphQL mutation query input
28
-     * @return array
29
-     * @throws Exception
30
-     */
31
-    public static function prepareFields(array $input): array
32
-    {
33
-        $args = [];
34
-
35
-        if (array_key_exists('capacity', $input)) {
36
-            $args['DTT_reg_limit'] = (int) $input['capacity'];
37
-        }
38
-
39
-        if (isset($input['description'])) {
40
-            $args['DTT_description'] = wp_kses_post($input['description']);
41
-        }
42
-
43
-        if (! empty($input['endDate'])) {
44
-            $args['DTT_EVT_end'] = new DateTime(sanitize_text_field($input['endDate']));
45
-        }
46
-
47
-        if (! empty($input['eventId'])) {
48
-            $args['EVT_ID'] = absint($input['eventId']);
49
-        } elseif (! empty($input['event'])) {
50
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['event']));
51
-            $args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
52
-        }
53
-
54
-        if (array_key_exists('isPrimary', $input)) {
55
-            $args['DTT_is_primary'] = (bool) $input['isPrimary'];
56
-        }
57
-
58
-        if (array_key_exists('isTrashed', $input)) {
59
-            $args['DTT_deleted'] = (bool) $input['isTrashed'];
60
-        }
61
-
62
-        if (isset($input['name'])) {
63
-            $args['DTT_name'] = sanitize_text_field($input['name']);
64
-        }
65
-
66
-        if (array_key_exists('order', $input)) {
67
-            $args['DTT_order'] = (int) $input['order'];
68
-        }
69
-
70
-        if (! empty($input['parent'])) {
71
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['parent']));
72
-            $args['DTT_parent'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
73
-        }
74
-
75
-        if (array_key_exists('reserved', $input)) {
76
-            $args['DTT_reserved'] = (int) $input['reserved'];
77
-        }
78
-
79
-        if (array_key_exists('sold', $input)) {
80
-            $args['DTT_sold'] = (int) $input['sold'];
81
-        }
82
-
83
-        if (! empty($input['startDate'])) {
84
-            $args['DTT_EVT_start'] = new DateTime(sanitize_text_field($input['startDate']));
85
-        }
86
-
87
-        if (! empty($input['tickets'])) {
88
-            $args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']);
89
-        }
90
-
91
-        return apply_filters(
92
-            'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__datetime_args',
93
-            $args,
94
-            $input
95
-        );
96
-    }
97
-
98
-
99
-    /**
100
-     * Sets the related tickets for the given datetime.
101
-     *
102
-     * @param EE_Datetime $entity  The datetime instance.
103
-     * @param array       $tickets Array of ticket IDs to relate.
104
-     * @throws EE_Error
105
-     * @throws InvalidDataTypeException
106
-     * @throws InvalidInterfaceException
107
-     * @throws InvalidArgumentException
108
-     * @throws ReflectionException
109
-     */
110
-    public static function setRelatedTickets(EE_Datetime $entity, array $tickets)
111
-    {
112
-        $relationName = 'Ticket';
113
-        // Remove all the existing related tickets
114
-        $entity->_remove_relations($relationName);
115
-
116
-        foreach ($tickets as $ID) {
117
-            $parts = Relay::fromGlobalId($ID);
118
-            if (! empty($parts['id']) && absint($parts['id'])) {
119
-                $entity->_add_relation_to(
120
-                    $parts['id'],
121
-                    $relationName
122
-                );
123
-            }
124
-        }
125
-    }
24
+	/**
25
+	 * Maps the GraphQL input to a format that the model functions can use
26
+	 *
27
+	 * @param array $input Data coming from the GraphQL mutation query input
28
+	 * @return array
29
+	 * @throws Exception
30
+	 */
31
+	public static function prepareFields(array $input): array
32
+	{
33
+		$args = [];
34
+
35
+		if (array_key_exists('capacity', $input)) {
36
+			$args['DTT_reg_limit'] = (int) $input['capacity'];
37
+		}
38
+
39
+		if (isset($input['description'])) {
40
+			$args['DTT_description'] = wp_kses_post($input['description']);
41
+		}
42
+
43
+		if (! empty($input['endDate'])) {
44
+			$args['DTT_EVT_end'] = new DateTime(sanitize_text_field($input['endDate']));
45
+		}
46
+
47
+		if (! empty($input['eventId'])) {
48
+			$args['EVT_ID'] = absint($input['eventId']);
49
+		} elseif (! empty($input['event'])) {
50
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['event']));
51
+			$args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
52
+		}
53
+
54
+		if (array_key_exists('isPrimary', $input)) {
55
+			$args['DTT_is_primary'] = (bool) $input['isPrimary'];
56
+		}
57
+
58
+		if (array_key_exists('isTrashed', $input)) {
59
+			$args['DTT_deleted'] = (bool) $input['isTrashed'];
60
+		}
61
+
62
+		if (isset($input['name'])) {
63
+			$args['DTT_name'] = sanitize_text_field($input['name']);
64
+		}
65
+
66
+		if (array_key_exists('order', $input)) {
67
+			$args['DTT_order'] = (int) $input['order'];
68
+		}
69
+
70
+		if (! empty($input['parent'])) {
71
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['parent']));
72
+			$args['DTT_parent'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
73
+		}
74
+
75
+		if (array_key_exists('reserved', $input)) {
76
+			$args['DTT_reserved'] = (int) $input['reserved'];
77
+		}
78
+
79
+		if (array_key_exists('sold', $input)) {
80
+			$args['DTT_sold'] = (int) $input['sold'];
81
+		}
82
+
83
+		if (! empty($input['startDate'])) {
84
+			$args['DTT_EVT_start'] = new DateTime(sanitize_text_field($input['startDate']));
85
+		}
86
+
87
+		if (! empty($input['tickets'])) {
88
+			$args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']);
89
+		}
90
+
91
+		return apply_filters(
92
+			'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__datetime_args',
93
+			$args,
94
+			$input
95
+		);
96
+	}
97
+
98
+
99
+	/**
100
+	 * Sets the related tickets for the given datetime.
101
+	 *
102
+	 * @param EE_Datetime $entity  The datetime instance.
103
+	 * @param array       $tickets Array of ticket IDs to relate.
104
+	 * @throws EE_Error
105
+	 * @throws InvalidDataTypeException
106
+	 * @throws InvalidInterfaceException
107
+	 * @throws InvalidArgumentException
108
+	 * @throws ReflectionException
109
+	 */
110
+	public static function setRelatedTickets(EE_Datetime $entity, array $tickets)
111
+	{
112
+		$relationName = 'Ticket';
113
+		// Remove all the existing related tickets
114
+		$entity->_remove_relations($relationName);
115
+
116
+		foreach ($tickets as $ID) {
117
+			$parts = Relay::fromGlobalId($ID);
118
+			if (! empty($parts['id']) && absint($parts['id'])) {
119
+				$entity->_add_relation_to(
120
+					$parts['id'],
121
+					$relationName
122
+				);
123
+			}
124
+		}
125
+	}
126 126
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/PriceMutation.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -13,64 +13,64 @@
 block discarded – undo
13 13
 class PriceMutation
14 14
 {
15 15
 
16
-    /**
17
-     * Maps the GraphQL input to a format that the model functions can use
18
-     *
19
-     * @param array $input Data coming from the GraphQL mutation query input
20
-     * @return array
21
-     */
22
-    public static function prepareFields(array $input): array
23
-    {
24
-        $args = [];
16
+	/**
17
+	 * Maps the GraphQL input to a format that the model functions can use
18
+	 *
19
+	 * @param array $input Data coming from the GraphQL mutation query input
20
+	 * @return array
21
+	 */
22
+	public static function prepareFields(array $input): array
23
+	{
24
+		$args = [];
25 25
 
26
-        // amount can be 0
27
-        if (array_key_exists('amount', $input)) {
28
-            $args['PRC_amount'] = (float) $input['amount'];
29
-        }
26
+		// amount can be 0
27
+		if (array_key_exists('amount', $input)) {
28
+			$args['PRC_amount'] = (float) $input['amount'];
29
+		}
30 30
 
31
-        if (isset($input['description'])) {
32
-            $args['PRC_desc'] = wp_kses_post($input['description']);
33
-        }
31
+		if (isset($input['description'])) {
32
+			$args['PRC_desc'] = wp_kses_post($input['description']);
33
+		}
34 34
 
35
-        if (array_key_exists('isDefault', $input)) {
36
-            $args['PRC_is_default'] = (bool) $input['isDefault'];
37
-        }
35
+		if (array_key_exists('isDefault', $input)) {
36
+			$args['PRC_is_default'] = (bool) $input['isDefault'];
37
+		}
38 38
 
39
-        if (array_key_exists('isTrashed', $input)) {
40
-            $args['PRC_deleted'] = (bool) $input['isTrashed'];
41
-        }
39
+		if (array_key_exists('isTrashed', $input)) {
40
+			$args['PRC_deleted'] = (bool) $input['isTrashed'];
41
+		}
42 42
 
43
-        if (isset($input['name'])) {
44
-            $args['PRC_name'] = sanitize_text_field($input['name']);
45
-        }
43
+		if (isset($input['name'])) {
44
+			$args['PRC_name'] = sanitize_text_field($input['name']);
45
+		}
46 46
 
47
-        if (! empty($input['order'])) {
48
-            $args['PRC_order'] = (int) $input['order'];
49
-        }
47
+		if (! empty($input['order'])) {
48
+			$args['PRC_order'] = (int) $input['order'];
49
+		}
50 50
 
51
-        if (! empty($input['overrides'])) {
52
-            $args['PRC_overrides'] = (int) $input['overrides'];
53
-        }
51
+		if (! empty($input['overrides'])) {
52
+			$args['PRC_overrides'] = (int) $input['overrides'];
53
+		}
54 54
 
55
-        if (! empty($input['parent'])) {
56
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['parent']));
57
-            $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
58
-        }
55
+		if (! empty($input['parent'])) {
56
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['parent']));
57
+			$args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
58
+		}
59 59
 
60
-        if (! empty($input['priceType'])) {
61
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType']));
62
-            $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
63
-        }
60
+		if (! empty($input['priceType'])) {
61
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['priceType']));
62
+			$args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
63
+		}
64 64
 
65
-        if (! empty($input['wpUser'])) {
66
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
67
-            $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
68
-        }
65
+		if (! empty($input['wpUser'])) {
66
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
67
+			$args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
68
+		}
69 69
 
70
-        return apply_filters(
71
-            'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__price_args',
72
-            $args,
73
-            $input
74
-        );
75
-    }
70
+		return apply_filters(
71
+			'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__price_args',
72
+			$args,
73
+			$input
74
+		);
75
+	}
76 76
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Datetime.php 1 patch
Indentation   +395 added lines, -395 removed lines patch added patch discarded remove patch
@@ -37,411 +37,411 @@
 block discarded – undo
37 37
 class Datetime extends TypeBase
38 38
 {
39 39
 
40
-    /**
41
-     * EventDate constructor.
42
-     *
43
-     * @param EEM_Datetime $datetime_model
44
-     */
45
-    public function __construct(EEM_Datetime $datetime_model)
46
-    {
47
-        $this->model = $datetime_model;
48
-        $this->setName($this->namespace . 'Datetime');
49
-        $this->setDescription(__('An event date', 'event_espresso'));
50
-        $this->setIsCustomPostType(false);
51
-        parent::__construct();
52
-    }
40
+	/**
41
+	 * EventDate constructor.
42
+	 *
43
+	 * @param EEM_Datetime $datetime_model
44
+	 */
45
+	public function __construct(EEM_Datetime $datetime_model)
46
+	{
47
+		$this->model = $datetime_model;
48
+		$this->setName($this->namespace . 'Datetime');
49
+		$this->setDescription(__('An event date', 'event_espresso'));
50
+		$this->setIsCustomPostType(false);
51
+		parent::__construct();
52
+	}
53 53
 
54 54
 
55
-    /**
56
-     * @return GraphQLFieldInterface[]
57
-     */
58
-    public function getFields(): array
59
-    {
60
-        $fields = [
61
-            new GraphQLField(
62
-                'id',
63
-                ['non_null' => 'ID'],
64
-                null,
65
-                esc_html__('The globally unique ID for the object.', 'event_espresso')
66
-            ),
67
-            new GraphQLOutputField(
68
-                'dbId',
69
-                ['non_null' => 'Int'],
70
-                'ID',
71
-                esc_html__('The datetime ID.', 'event_espresso')
72
-            ),
73
-            new GraphQLOutputField(
74
-                'cacheId',
75
-                ['non_null' => 'String'],
76
-                null,
77
-                esc_html__('The cache ID of the object.', 'event_espresso')
78
-            ),
79
-            new GraphQLField(
80
-                'capacity',
81
-                'Int',
82
-                'reg_limit',
83
-                esc_html__('Registration Limit for this time', 'event_espresso'),
84
-                [$this, 'parseInfiniteValue']
85
-            ),
86
-            new GraphQLField(
87
-                'description',
88
-                'String',
89
-                'description',
90
-                esc_html__('Description for Datetime', 'event_espresso')
91
-            ),
92
-            new GraphQLField(
93
-                'endDate',
94
-                'String',
95
-                'end_date_and_time',
96
-                esc_html__('End date and time of the Event', 'event_espresso'),
97
-                [$this, 'formatDatetime']
98
-            ),
99
-            new GraphQLOutputField(
100
-                'event',
101
-                $this->namespace . 'Event',
102
-                null,
103
-                esc_html__('Event of the datetime.', 'event_espresso')
104
-            ),
105
-            new GraphQLInputField(
106
-                'event',
107
-                'ID',
108
-                null,
109
-                esc_html__('Globally unique event ID of the datetime.', 'event_espresso')
110
-            ),
111
-            new GraphQLInputField(
112
-                'eventId',
113
-                'Int',
114
-                null,
115
-                esc_html__('Event ID of the datetime.', 'event_espresso')
116
-            ),
117
-            new GraphQLOutputField(
118
-                'isActive',
119
-                'Boolean',
120
-                'is_active',
121
-                esc_html__('Flag indicating datetime is active', 'event_espresso')
122
-            ),
123
-            new GraphQLOutputField(
124
-                'isExpired',
125
-                'Boolean',
126
-                'is_expired',
127
-                esc_html__('Flag indicating datetime is expired or not', 'event_espresso')
128
-            ),
129
-            new GraphQLField(
130
-                'isPrimary',
131
-                'Boolean',
132
-                'is_primary',
133
-                esc_html__('Flag indicating datetime is primary one for event', 'event_espresso')
134
-            ),
135
-            new GraphQLOutputField(
136
-                'isSoldOut',
137
-                'Boolean',
138
-                'sold_out',
139
-                esc_html__(
140
-                    'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit',
141
-                    'event_espresso'
142
-                )
143
-            ),
144
-            new GraphQLField(
145
-                'isTrashed',
146
-                'Boolean',
147
-                null,
148
-                esc_html__('Flag indicating datetime has been trashed.', 'event_espresso'),
149
-                null,
150
-                [$this, 'getIsTrashed']
151
-            ),
152
-            new GraphQLOutputField(
153
-                'isUpcoming',
154
-                'Boolean',
155
-                'is_upcoming',
156
-                esc_html__('Whether the date is upcoming', 'event_espresso')
157
-            ),
158
-            new GraphQLOutputField(
159
-                'length',
160
-                'Int',
161
-                'length',
162
-                esc_html__('The length of the event (start to end time) in seconds', 'event_espresso')
163
-            ),
164
-            new GraphQLField(
165
-                'name',
166
-                'String',
167
-                'name',
168
-                esc_html__('Datetime Name', 'event_espresso')
169
-            ),
170
-            new GraphQLField(
171
-                'order',
172
-                'Int',
173
-                'order',
174
-                esc_html__('The order in which the Datetime is displayed', 'event_espresso')
175
-            ),
176
-            new GraphQLOutputField(
177
-                'parent',
178
-                $this->name(),
179
-                null,
180
-                esc_html__('The parent datetime of the current datetime', 'event_espresso')
181
-            ),
182
-            new GraphQLInputField(
183
-                'parent',
184
-                'ID',
185
-                null,
186
-                esc_html__('The parent datetime ID', 'event_espresso')
187
-            ),
188
-            new GraphQLField(
189
-                'reserved',
190
-                'Int',
191
-                'reserved',
192
-                esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso')
193
-            ),
194
-            new GraphQLField(
195
-                'startDate',
196
-                'String',
197
-                'start_date_and_time',
198
-                esc_html__('Start date and time of the Event', 'event_espresso'),
199
-                [$this, 'formatDatetime']
200
-            ),
201
-            new GraphQLField(
202
-                'sold',
203
-                'Int',
204
-                'sold',
205
-                esc_html__('How many sales for this Datetime that have occurred', 'event_espresso')
206
-            ),
207
-            new GraphQLOutputField(
208
-                'status',
209
-                $this->namespace . 'DatetimeStatusEnum',
210
-                'get_active_status',
211
-                esc_html__('Datetime status', 'event_espresso')
212
-            ),
213
-            new GraphQLInputField(
214
-                'tickets',
215
-                ['list_of' => 'ID'],
216
-                null,
217
-                sprintf(
218
-                    '%1$s %2$s',
219
-                    esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'),
220
-                    esc_html__('Ignored if empty.', 'event_espresso')
221
-                )
222
-            ),
223
-        ];
55
+	/**
56
+	 * @return GraphQLFieldInterface[]
57
+	 */
58
+	public function getFields(): array
59
+	{
60
+		$fields = [
61
+			new GraphQLField(
62
+				'id',
63
+				['non_null' => 'ID'],
64
+				null,
65
+				esc_html__('The globally unique ID for the object.', 'event_espresso')
66
+			),
67
+			new GraphQLOutputField(
68
+				'dbId',
69
+				['non_null' => 'Int'],
70
+				'ID',
71
+				esc_html__('The datetime ID.', 'event_espresso')
72
+			),
73
+			new GraphQLOutputField(
74
+				'cacheId',
75
+				['non_null' => 'String'],
76
+				null,
77
+				esc_html__('The cache ID of the object.', 'event_espresso')
78
+			),
79
+			new GraphQLField(
80
+				'capacity',
81
+				'Int',
82
+				'reg_limit',
83
+				esc_html__('Registration Limit for this time', 'event_espresso'),
84
+				[$this, 'parseInfiniteValue']
85
+			),
86
+			new GraphQLField(
87
+				'description',
88
+				'String',
89
+				'description',
90
+				esc_html__('Description for Datetime', 'event_espresso')
91
+			),
92
+			new GraphQLField(
93
+				'endDate',
94
+				'String',
95
+				'end_date_and_time',
96
+				esc_html__('End date and time of the Event', 'event_espresso'),
97
+				[$this, 'formatDatetime']
98
+			),
99
+			new GraphQLOutputField(
100
+				'event',
101
+				$this->namespace . 'Event',
102
+				null,
103
+				esc_html__('Event of the datetime.', 'event_espresso')
104
+			),
105
+			new GraphQLInputField(
106
+				'event',
107
+				'ID',
108
+				null,
109
+				esc_html__('Globally unique event ID of the datetime.', 'event_espresso')
110
+			),
111
+			new GraphQLInputField(
112
+				'eventId',
113
+				'Int',
114
+				null,
115
+				esc_html__('Event ID of the datetime.', 'event_espresso')
116
+			),
117
+			new GraphQLOutputField(
118
+				'isActive',
119
+				'Boolean',
120
+				'is_active',
121
+				esc_html__('Flag indicating datetime is active', 'event_espresso')
122
+			),
123
+			new GraphQLOutputField(
124
+				'isExpired',
125
+				'Boolean',
126
+				'is_expired',
127
+				esc_html__('Flag indicating datetime is expired or not', 'event_espresso')
128
+			),
129
+			new GraphQLField(
130
+				'isPrimary',
131
+				'Boolean',
132
+				'is_primary',
133
+				esc_html__('Flag indicating datetime is primary one for event', 'event_espresso')
134
+			),
135
+			new GraphQLOutputField(
136
+				'isSoldOut',
137
+				'Boolean',
138
+				'sold_out',
139
+				esc_html__(
140
+					'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit',
141
+					'event_espresso'
142
+				)
143
+			),
144
+			new GraphQLField(
145
+				'isTrashed',
146
+				'Boolean',
147
+				null,
148
+				esc_html__('Flag indicating datetime has been trashed.', 'event_espresso'),
149
+				null,
150
+				[$this, 'getIsTrashed']
151
+			),
152
+			new GraphQLOutputField(
153
+				'isUpcoming',
154
+				'Boolean',
155
+				'is_upcoming',
156
+				esc_html__('Whether the date is upcoming', 'event_espresso')
157
+			),
158
+			new GraphQLOutputField(
159
+				'length',
160
+				'Int',
161
+				'length',
162
+				esc_html__('The length of the event (start to end time) in seconds', 'event_espresso')
163
+			),
164
+			new GraphQLField(
165
+				'name',
166
+				'String',
167
+				'name',
168
+				esc_html__('Datetime Name', 'event_espresso')
169
+			),
170
+			new GraphQLField(
171
+				'order',
172
+				'Int',
173
+				'order',
174
+				esc_html__('The order in which the Datetime is displayed', 'event_espresso')
175
+			),
176
+			new GraphQLOutputField(
177
+				'parent',
178
+				$this->name(),
179
+				null,
180
+				esc_html__('The parent datetime of the current datetime', 'event_espresso')
181
+			),
182
+			new GraphQLInputField(
183
+				'parent',
184
+				'ID',
185
+				null,
186
+				esc_html__('The parent datetime ID', 'event_espresso')
187
+			),
188
+			new GraphQLField(
189
+				'reserved',
190
+				'Int',
191
+				'reserved',
192
+				esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso')
193
+			),
194
+			new GraphQLField(
195
+				'startDate',
196
+				'String',
197
+				'start_date_and_time',
198
+				esc_html__('Start date and time of the Event', 'event_espresso'),
199
+				[$this, 'formatDatetime']
200
+			),
201
+			new GraphQLField(
202
+				'sold',
203
+				'Int',
204
+				'sold',
205
+				esc_html__('How many sales for this Datetime that have occurred', 'event_espresso')
206
+			),
207
+			new GraphQLOutputField(
208
+				'status',
209
+				$this->namespace . 'DatetimeStatusEnum',
210
+				'get_active_status',
211
+				esc_html__('Datetime status', 'event_espresso')
212
+			),
213
+			new GraphQLInputField(
214
+				'tickets',
215
+				['list_of' => 'ID'],
216
+				null,
217
+				sprintf(
218
+					'%1$s %2$s',
219
+					esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'),
220
+					esc_html__('Ignored if empty.', 'event_espresso')
221
+				)
222
+			),
223
+		];
224 224
 
225
-        return apply_filters(
226
-            'FHEE__EventEspresso_core_domain_services_graphql_types__datetime_fields',
227
-            $fields,
228
-            $this->name,
229
-            $this->model
230
-        );
231
-    }
225
+		return apply_filters(
226
+			'FHEE__EventEspresso_core_domain_services_graphql_types__datetime_fields',
227
+			$fields,
228
+			$this->name,
229
+			$this->model
230
+		);
231
+	}
232 232
 
233 233
 
234
-    /**
235
-     * @param EE_Datetime   $source  The source that's passed down the GraphQL queries
236
-     * @param array       $args    The inputArgs on the field
237
-     * @param AppContext  $context The AppContext passed down the GraphQL tree
238
-     * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
239
-     * @return string
240
-     * @throws Exception
241
-     * @throws InvalidArgumentException
242
-     * @throws InvalidDataTypeException
243
-     * @throws InvalidInterfaceException
244
-     * @throws ReflectionException
245
-     * @throws UserError
246
-     * @throws UnexpectedEntityException
247
-     * @since $VID:$
248
-     */
249
-    public function getIsTrashed(EE_Datetime $source, array $args, AppContext $context, ResolveInfo $info)
250
-    {
251
-        return (bool) $source->get('DTT_deleted');
252
-    }
234
+	/**
235
+	 * @param EE_Datetime   $source  The source that's passed down the GraphQL queries
236
+	 * @param array       $args    The inputArgs on the field
237
+	 * @param AppContext  $context The AppContext passed down the GraphQL tree
238
+	 * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
239
+	 * @return string
240
+	 * @throws Exception
241
+	 * @throws InvalidArgumentException
242
+	 * @throws InvalidDataTypeException
243
+	 * @throws InvalidInterfaceException
244
+	 * @throws ReflectionException
245
+	 * @throws UserError
246
+	 * @throws UnexpectedEntityException
247
+	 * @since $VID:$
248
+	 */
249
+	public function getIsTrashed(EE_Datetime $source, array $args, AppContext $context, ResolveInfo $info)
250
+	{
251
+		return (bool) $source->get('DTT_deleted');
252
+	}
253 253
 
254
-    /**
255
-     * Return the base mutation config for bulk update.
256
-     *
257
-     * @param string $base_input
258
-     * @return array
259
-     */
260
-    public static function bulkUpdateBaseConfig($base_input)
261
-    {
262
-        return [
263
-            'inputFields'     => [
264
-                /**
265
-                 * represents the input that is unique for each entity
266
-                 * e.g. dates may be unique for dateimes and tickets
267
-                 */
268
-                'uniqueInputs' => [
269
-                    'type'        => [
270
-                        'non_null' => ['list_of' => $base_input],
271
-                    ],
272
-                    'description' => esc_html__(
273
-                        'List of unique inputs for each entity in bulk update',
274
-                        'event_espresso'
275
-                    ),
276
-                ],
277
-                /**
278
-                 * represents the common input for all entities
279
-                 * e.g. capacity or quantity may be same for all dates/tickets
280
-                 */
281
-                'sharedInput' => [
282
-                    'type'        => $base_input,
283
-                    'description' => esc_html__(
284
-                        'Shared input for all entities in bulk update',
285
-                        'event_espresso'
286
-                    ),
287
-                ],
288
-            ],
289
-            'outputFields'        => [
290
-                'updated' => [
291
-                    'type' => ['list_of' => 'ID'],
292
-                ],
293
-                'failed' => [
294
-                    'type' => ['list_of' => 'ID'],
295
-                ],
296
-            ],
297
-        ];
298
-    }
254
+	/**
255
+	 * Return the base mutation config for bulk update.
256
+	 *
257
+	 * @param string $base_input
258
+	 * @return array
259
+	 */
260
+	public static function bulkUpdateBaseConfig($base_input)
261
+	{
262
+		return [
263
+			'inputFields'     => [
264
+				/**
265
+				 * represents the input that is unique for each entity
266
+				 * e.g. dates may be unique for dateimes and tickets
267
+				 */
268
+				'uniqueInputs' => [
269
+					'type'        => [
270
+						'non_null' => ['list_of' => $base_input],
271
+					],
272
+					'description' => esc_html__(
273
+						'List of unique inputs for each entity in bulk update',
274
+						'event_espresso'
275
+					),
276
+				],
277
+				/**
278
+				 * represents the common input for all entities
279
+				 * e.g. capacity or quantity may be same for all dates/tickets
280
+				 */
281
+				'sharedInput' => [
282
+					'type'        => $base_input,
283
+					'description' => esc_html__(
284
+						'Shared input for all entities in bulk update',
285
+						'event_espresso'
286
+					),
287
+				],
288
+			],
289
+			'outputFields'        => [
290
+				'updated' => [
291
+					'type' => ['list_of' => 'ID'],
292
+				],
293
+				'failed' => [
294
+					'type' => ['list_of' => 'ID'],
295
+				],
296
+			],
297
+		];
298
+	}
299 299
 
300 300
 
301
-    /**
302
-     * @param array $inputFields The mutation input fields.
303
-     * @throws InvalidArgumentException
304
-     * @throws ReflectionException
305
-     * @since $VID:$
306
-     */
307
-    public function registerMutations(array $inputFields)
308
-    {
309
-        register_graphql_input_type(
310
-            'Update' .  $this->name() . 'BaseInput',
311
-            [
312
-                'fields' => $inputFields,
313
-            ]
314
-        );
315
-        // Register mutation to update an entity.
316
-        register_graphql_mutation(
317
-            'update' . $this->name(),
318
-            [
319
-                'inputFields'         => $inputFields,
320
-                'outputFields'        => [
321
-                    lcfirst($this->name()) => [
322
-                        'type'    => $this->name(),
323
-                        'resolve' => [$this, 'resolveFromPayload'],
324
-                    ],
325
-                ],
326
-                'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this),
327
-            ]
328
-        );
329
-        $base_input = 'Update' .  $this->name() . 'BaseInput';
330
-        // Register mutation to update an entity.
331
-        register_graphql_mutation(
332
-            'bulkUpdate' . $this->name(),
333
-            array_merge(
334
-                Datetime::bulkUpdateBaseConfig($base_input),
335
-                [
336
-                    'mutateAndGetPayload' => DatetimeBulkUpdate::mutateAndGetPayload($this->model, $this),
337
-                ]
338
-            )
339
-        );
301
+	/**
302
+	 * @param array $inputFields The mutation input fields.
303
+	 * @throws InvalidArgumentException
304
+	 * @throws ReflectionException
305
+	 * @since $VID:$
306
+	 */
307
+	public function registerMutations(array $inputFields)
308
+	{
309
+		register_graphql_input_type(
310
+			'Update' .  $this->name() . 'BaseInput',
311
+			[
312
+				'fields' => $inputFields,
313
+			]
314
+		);
315
+		// Register mutation to update an entity.
316
+		register_graphql_mutation(
317
+			'update' . $this->name(),
318
+			[
319
+				'inputFields'         => $inputFields,
320
+				'outputFields'        => [
321
+					lcfirst($this->name()) => [
322
+						'type'    => $this->name(),
323
+						'resolve' => [$this, 'resolveFromPayload'],
324
+					],
325
+				],
326
+				'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this),
327
+			]
328
+		);
329
+		$base_input = 'Update' .  $this->name() . 'BaseInput';
330
+		// Register mutation to update an entity.
331
+		register_graphql_mutation(
332
+			'bulkUpdate' . $this->name(),
333
+			array_merge(
334
+				Datetime::bulkUpdateBaseConfig($base_input),
335
+				[
336
+					'mutateAndGetPayload' => DatetimeBulkUpdate::mutateAndGetPayload($this->model, $this),
337
+				]
338
+			)
339
+		);
340 340
 
341
-        // Register mutation to update an entity.
342
-        register_graphql_mutation(
343
-            'bulkDelete' . $this->namespace . 'Entities',
344
-            [
345
-                'inputFields'         => [
346
-                    'entityIds'  => [
347
-                        'type'        => [
348
-                            'non_null' => ['list_of' => 'ID'],
349
-                        ],
350
-                        'description' => esc_html__('The list of GUIDs of the entities to be deleted.', 'event_espresso'),
351
-                    ],
352
-                    'entityType' => [
353
-                        'type'        => [
354
-                            'non_null' => $this->namespace . 'ModelNameEnum',
355
-                        ],
356
-                        'description' => esc_html__('The entity type for the IDs', 'event_espresso'),
357
-                    ],
358
-                    'deletePermanently' => [
359
-                        'type'        => 'Boolean',
360
-                        'description' => esc_html__('Whether to delete the entities permanently.', 'event_espresso'),
361
-                    ],
362
-                ],
363
-                'outputFields'        => [
364
-                    'deleted' => [
365
-                        'type' => ['list_of' => 'ID'],
366
-                    ],
367
-                    'failed' => [
368
-                        'type' => ['list_of' => 'ID'],
369
-                    ],
370
-                ],
371
-                'mutateAndGetPayload' => BulkEntityDelete::mutateAndGetPayload(),
372
-            ]
373
-        );
374
-        // Register mutation to delete an entity.
375
-        register_graphql_mutation(
376
-            'delete' . $this->name(),
377
-            [
378
-                'inputFields'         => [
379
-                    'id'                => $inputFields['id'],
380
-                    'deletePermanently' => [
381
-                        'type'        => 'Boolean',
382
-                        'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
383
-                    ],
384
-                ],
385
-                'outputFields'        => [
386
-                    lcfirst($this->name()) => [
387
-                        'type'        => $this->name(),
388
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
389
-                        'resolve'     => static function ($payload) {
390
-                            $deleted = (object) $payload['deleted'];
341
+		// Register mutation to update an entity.
342
+		register_graphql_mutation(
343
+			'bulkDelete' . $this->namespace . 'Entities',
344
+			[
345
+				'inputFields'         => [
346
+					'entityIds'  => [
347
+						'type'        => [
348
+							'non_null' => ['list_of' => 'ID'],
349
+						],
350
+						'description' => esc_html__('The list of GUIDs of the entities to be deleted.', 'event_espresso'),
351
+					],
352
+					'entityType' => [
353
+						'type'        => [
354
+							'non_null' => $this->namespace . 'ModelNameEnum',
355
+						],
356
+						'description' => esc_html__('The entity type for the IDs', 'event_espresso'),
357
+					],
358
+					'deletePermanently' => [
359
+						'type'        => 'Boolean',
360
+						'description' => esc_html__('Whether to delete the entities permanently.', 'event_espresso'),
361
+					],
362
+				],
363
+				'outputFields'        => [
364
+					'deleted' => [
365
+						'type' => ['list_of' => 'ID'],
366
+					],
367
+					'failed' => [
368
+						'type' => ['list_of' => 'ID'],
369
+					],
370
+				],
371
+				'mutateAndGetPayload' => BulkEntityDelete::mutateAndGetPayload(),
372
+			]
373
+		);
374
+		// Register mutation to delete an entity.
375
+		register_graphql_mutation(
376
+			'delete' . $this->name(),
377
+			[
378
+				'inputFields'         => [
379
+					'id'                => $inputFields['id'],
380
+					'deletePermanently' => [
381
+						'type'        => 'Boolean',
382
+						'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
383
+					],
384
+				],
385
+				'outputFields'        => [
386
+					lcfirst($this->name()) => [
387
+						'type'        => $this->name(),
388
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
389
+						'resolve'     => static function ($payload) {
390
+							$deleted = (object) $payload['deleted'];
391 391
 
392
-                            return ! empty($deleted) ? $deleted : null;
393
-                        },
394
-                    ],
395
-                ],
396
-                'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this),
397
-            ]
398
-        );
392
+							return ! empty($deleted) ? $deleted : null;
393
+						},
394
+					],
395
+				],
396
+				'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this),
397
+			]
398
+		);
399 399
 
400
-        // remove primary key from input.
401
-        unset($inputFields['id']);
402
-        // Register mutation to update an entity.
403
-        register_graphql_mutation(
404
-            'create' . $this->name(),
405
-            [
406
-                'inputFields'         => $inputFields,
407
-                'outputFields'        => [
408
-                    lcfirst($this->name()) => [
409
-                        'type'    => $this->name(),
410
-                        'resolve' => [$this, 'resolveFromPayload'],
411
-                    ],
412
-                ],
413
-                'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this),
414
-            ]
415
-        );
400
+		// remove primary key from input.
401
+		unset($inputFields['id']);
402
+		// Register mutation to update an entity.
403
+		register_graphql_mutation(
404
+			'create' . $this->name(),
405
+			[
406
+				'inputFields'         => $inputFields,
407
+				'outputFields'        => [
408
+					lcfirst($this->name()) => [
409
+						'type'    => $this->name(),
410
+						'resolve' => [$this, 'resolveFromPayload'],
411
+					],
412
+				],
413
+				'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this),
414
+			]
415
+		);
416 416
 
417
-        // Register mutation to update an entity.
418
-        register_graphql_mutation(
419
-            'reorder' . $this->namespace . 'Entities',
420
-            [
421
-                'inputFields'         => [
422
-                    'entityIds'  => [
423
-                        'type'        => [
424
-                            'non_null' => ['list_of' => 'ID'],
425
-                        ],
426
-                        'description' => esc_html__('The reordered list of entity GUIDs.', 'event_espresso'),
427
-                    ],
428
-                    'entityType' => [
429
-                        'type'        => [
430
-                            'non_null' => $this->namespace . 'ModelNameEnum',
431
-                        ],
432
-                        'description' => esc_html__('The entity type for the IDs', 'event_espresso'),
433
-                    ],
434
-                ],
435
-                'outputFields'        => [
436
-                    'ok' => [
437
-                        'type'    => 'Boolean',
438
-                        'resolve' => function ($payload) {
439
-                            return (bool) $payload['ok'];
440
-                        },
441
-                    ],
442
-                ],
443
-                'mutateAndGetPayload' => EntityReorder::mutateAndGetPayload(),
444
-            ]
445
-        );
446
-    }
417
+		// Register mutation to update an entity.
418
+		register_graphql_mutation(
419
+			'reorder' . $this->namespace . 'Entities',
420
+			[
421
+				'inputFields'         => [
422
+					'entityIds'  => [
423
+						'type'        => [
424
+							'non_null' => ['list_of' => 'ID'],
425
+						],
426
+						'description' => esc_html__('The reordered list of entity GUIDs.', 'event_espresso'),
427
+					],
428
+					'entityType' => [
429
+						'type'        => [
430
+							'non_null' => $this->namespace . 'ModelNameEnum',
431
+						],
432
+						'description' => esc_html__('The entity type for the IDs', 'event_espresso'),
433
+					],
434
+				],
435
+				'outputFields'        => [
436
+					'ok' => [
437
+						'type'    => 'Boolean',
438
+						'resolve' => function ($payload) {
439
+							return (bool) $payload['ok'];
440
+						},
441
+					],
442
+				],
443
+				'mutateAndGetPayload' => EntityReorder::mutateAndGetPayload(),
444
+			]
445
+		);
446
+	}
447 447
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Event.php 2 patches
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -21,214 +21,214 @@
 block discarded – undo
21 21
 class Event extends TypeBase
22 22
 {
23 23
 
24
-    /**
25
-     * Event constructor.
26
-     *
27
-     * @param EEM_Event $event_model
28
-     */
29
-    public function __construct(EEM_Event $event_model)
30
-    {
31
-        $this->model = $event_model;
32
-        $this->setName($this->namespace . 'Event');
33
-        $this->setIsCustomPostType(true);
34
-        parent::__construct();
35
-    }
24
+	/**
25
+	 * Event constructor.
26
+	 *
27
+	 * @param EEM_Event $event_model
28
+	 */
29
+	public function __construct(EEM_Event $event_model)
30
+	{
31
+		$this->model = $event_model;
32
+		$this->setName($this->namespace . 'Event');
33
+		$this->setIsCustomPostType(true);
34
+		parent::__construct();
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * @return GraphQLFieldInterface[]
40
-     */
41
-    public function getFields(): array
42
-    {
43
-        $fields = [
44
-            new GraphQLField(
45
-                'allowDonations',
46
-                'Boolean',
47
-                'donations',
48
-                esc_html__('Accept Donations?', 'event_espresso')
49
-            ),
50
-            new GraphQLField(
51
-                'allowOverflow',
52
-                'Boolean',
53
-                'allow_overflow',
54
-                esc_html__('Enable Wait List for Event', 'event_espresso')
55
-            ),
56
-            new GraphQLField(
57
-                'altRegPage',
58
-                'String',
59
-                'external_url',
60
-                esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso')
61
-            ),
62
-            new GraphQLOutputField(
63
-                'cacheId',
64
-                ['non_null' => 'String'],
65
-                null,
66
-                esc_html__('The cache ID of the object.', 'event_espresso')
67
-            ),
68
-            new GraphQLField(
69
-                'created',
70
-                'String',
71
-                'created',
72
-                esc_html__('Date/Time Event Created', 'event_espresso')
73
-            ),
74
-            new GraphQLOutputField(
75
-                'dbId',
76
-                ['non_null' => 'Int'],
77
-                'ID',
78
-                esc_html__('The event ID.', 'event_espresso')
79
-            ),
80
-            new GraphQLOutputField(
81
-                'defaultRegStatus',
82
-                $this->namespace . 'RegistrationStatusEnum',
83
-                'default_registration_status',
84
-                esc_html__('Default Event Registration Status', 'event_espresso')
85
-            ),
86
-            new GraphQLField(
87
-                'description',
88
-                'String',
89
-                'description',
90
-                esc_html__('Event Description', 'event_espresso')
91
-            ),
92
-            new GraphQLField(
93
-                'displayDescription',
94
-                'Boolean',
95
-                'display_description',
96
-                esc_html__('Display Description Flag', 'event_espresso')
97
-            ),
98
-            new GraphQLField(
99
-                'displayTicketSelector',
100
-                'Boolean',
101
-                'display_ticket_selector',
102
-                esc_html__('Display Ticket Selector Flag', 'event_espresso')
103
-            ),
104
-            new GraphQLOutputField(
105
-                'isActive',
106
-                'Boolean',
107
-                'is_active',
108
-                esc_html__('Flag indicating event is active', 'event_espresso')
109
-            ),
110
-            new GraphQLOutputField(
111
-                'isCancelled',
112
-                'Boolean',
113
-                'is_cancelled',
114
-                esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso')
115
-            ),
116
-            new GraphQLOutputField(
117
-                'isExpired',
118
-                'Boolean',
119
-                'is_expired',
120
-                esc_html__('Flag indicating event is expired or not', 'event_espresso')
121
-            ),
122
-            new GraphQLOutputField(
123
-                'isInactive',
124
-                'Boolean',
125
-                'is_inactive',
126
-                esc_html__('Flag indicating event is inactive', 'event_espresso')
127
-            ),
128
-            new GraphQLOutputField(
129
-                'isPostponed',
130
-                'Boolean',
131
-                'is_postponed',
132
-                esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso')
133
-            ),
134
-            new GraphQLOutputField(
135
-                'isSoldOut',
136
-                'Boolean',
137
-                'is_sold_out',
138
-                esc_html__(
139
-                    'Flag indicating whether the tickets sold for the event, met or exceed the registration limit',
140
-                    'event_espresso'
141
-                )
142
-            ),
143
-            new GraphQLOutputField(
144
-                'isUpcoming',
145
-                'Boolean',
146
-                'is_upcoming',
147
-                esc_html__('Whether the event is upcoming', 'event_espresso')
148
-            ),
149
-            new GraphQLInputField(
150
-                'manager',
151
-                'String',
152
-                null,
153
-                esc_html__('Globally unique event ID for the event manager', 'event_espresso')
154
-            ),
155
-            new GraphQLOutputField(
156
-                'manager',
157
-                'User',
158
-                null,
159
-                esc_html__('Event Manager', 'event_espresso')
160
-            ),
161
-            new GraphQLField(
162
-                'maxRegistrations',
163
-                'Int',
164
-                'additional_limit',
165
-                esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso')
166
-            ),
167
-            new GraphQLField(
168
-                'memberOnly',
169
-                'Boolean',
170
-                'member_only',
171
-                esc_html__('Member-Only Event Flag', 'event_espresso')
172
-            ),
173
-            new GraphQLField(
174
-                'name',
175
-                'String',
176
-                'name',
177
-                esc_html__('Event Name', 'event_espresso')
178
-            ),
179
-            new GraphQLField(
180
-                'order',
181
-                'Int',
182
-                'order',
183
-                esc_html__('Event Menu Order', 'event_espresso')
184
-            ),
185
-            new GraphQLField(
186
-                'phoneNumber',
187
-                'String',
188
-                'phone',
189
-                esc_html__('Event Phone Number', 'event_espresso')
190
-            ),
191
-            new GraphQLField(
192
-                'shortDescription',
193
-                'String',
194
-                'short_description',
195
-                esc_html__('Event Short Description', 'event_espresso')
196
-            ),
197
-            new GraphQLField(
198
-                'timezoneString',
199
-                'String',
200
-                'timezone_string',
201
-                esc_html__('Timezone (name) for Event times', 'event_espresso')
202
-            ),
203
-            new GraphQLField(
204
-                'visibleOn',
205
-                'String',
206
-                'visible_on',
207
-                esc_html__('Event Visible Date', 'event_espresso')
208
-            ),
209
-        ];
38
+	/**
39
+	 * @return GraphQLFieldInterface[]
40
+	 */
41
+	public function getFields(): array
42
+	{
43
+		$fields = [
44
+			new GraphQLField(
45
+				'allowDonations',
46
+				'Boolean',
47
+				'donations',
48
+				esc_html__('Accept Donations?', 'event_espresso')
49
+			),
50
+			new GraphQLField(
51
+				'allowOverflow',
52
+				'Boolean',
53
+				'allow_overflow',
54
+				esc_html__('Enable Wait List for Event', 'event_espresso')
55
+			),
56
+			new GraphQLField(
57
+				'altRegPage',
58
+				'String',
59
+				'external_url',
60
+				esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso')
61
+			),
62
+			new GraphQLOutputField(
63
+				'cacheId',
64
+				['non_null' => 'String'],
65
+				null,
66
+				esc_html__('The cache ID of the object.', 'event_espresso')
67
+			),
68
+			new GraphQLField(
69
+				'created',
70
+				'String',
71
+				'created',
72
+				esc_html__('Date/Time Event Created', 'event_espresso')
73
+			),
74
+			new GraphQLOutputField(
75
+				'dbId',
76
+				['non_null' => 'Int'],
77
+				'ID',
78
+				esc_html__('The event ID.', 'event_espresso')
79
+			),
80
+			new GraphQLOutputField(
81
+				'defaultRegStatus',
82
+				$this->namespace . 'RegistrationStatusEnum',
83
+				'default_registration_status',
84
+				esc_html__('Default Event Registration Status', 'event_espresso')
85
+			),
86
+			new GraphQLField(
87
+				'description',
88
+				'String',
89
+				'description',
90
+				esc_html__('Event Description', 'event_espresso')
91
+			),
92
+			new GraphQLField(
93
+				'displayDescription',
94
+				'Boolean',
95
+				'display_description',
96
+				esc_html__('Display Description Flag', 'event_espresso')
97
+			),
98
+			new GraphQLField(
99
+				'displayTicketSelector',
100
+				'Boolean',
101
+				'display_ticket_selector',
102
+				esc_html__('Display Ticket Selector Flag', 'event_espresso')
103
+			),
104
+			new GraphQLOutputField(
105
+				'isActive',
106
+				'Boolean',
107
+				'is_active',
108
+				esc_html__('Flag indicating event is active', 'event_espresso')
109
+			),
110
+			new GraphQLOutputField(
111
+				'isCancelled',
112
+				'Boolean',
113
+				'is_cancelled',
114
+				esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso')
115
+			),
116
+			new GraphQLOutputField(
117
+				'isExpired',
118
+				'Boolean',
119
+				'is_expired',
120
+				esc_html__('Flag indicating event is expired or not', 'event_espresso')
121
+			),
122
+			new GraphQLOutputField(
123
+				'isInactive',
124
+				'Boolean',
125
+				'is_inactive',
126
+				esc_html__('Flag indicating event is inactive', 'event_espresso')
127
+			),
128
+			new GraphQLOutputField(
129
+				'isPostponed',
130
+				'Boolean',
131
+				'is_postponed',
132
+				esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso')
133
+			),
134
+			new GraphQLOutputField(
135
+				'isSoldOut',
136
+				'Boolean',
137
+				'is_sold_out',
138
+				esc_html__(
139
+					'Flag indicating whether the tickets sold for the event, met or exceed the registration limit',
140
+					'event_espresso'
141
+				)
142
+			),
143
+			new GraphQLOutputField(
144
+				'isUpcoming',
145
+				'Boolean',
146
+				'is_upcoming',
147
+				esc_html__('Whether the event is upcoming', 'event_espresso')
148
+			),
149
+			new GraphQLInputField(
150
+				'manager',
151
+				'String',
152
+				null,
153
+				esc_html__('Globally unique event ID for the event manager', 'event_espresso')
154
+			),
155
+			new GraphQLOutputField(
156
+				'manager',
157
+				'User',
158
+				null,
159
+				esc_html__('Event Manager', 'event_espresso')
160
+			),
161
+			new GraphQLField(
162
+				'maxRegistrations',
163
+				'Int',
164
+				'additional_limit',
165
+				esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso')
166
+			),
167
+			new GraphQLField(
168
+				'memberOnly',
169
+				'Boolean',
170
+				'member_only',
171
+				esc_html__('Member-Only Event Flag', 'event_espresso')
172
+			),
173
+			new GraphQLField(
174
+				'name',
175
+				'String',
176
+				'name',
177
+				esc_html__('Event Name', 'event_espresso')
178
+			),
179
+			new GraphQLField(
180
+				'order',
181
+				'Int',
182
+				'order',
183
+				esc_html__('Event Menu Order', 'event_espresso')
184
+			),
185
+			new GraphQLField(
186
+				'phoneNumber',
187
+				'String',
188
+				'phone',
189
+				esc_html__('Event Phone Number', 'event_espresso')
190
+			),
191
+			new GraphQLField(
192
+				'shortDescription',
193
+				'String',
194
+				'short_description',
195
+				esc_html__('Event Short Description', 'event_espresso')
196
+			),
197
+			new GraphQLField(
198
+				'timezoneString',
199
+				'String',
200
+				'timezone_string',
201
+				esc_html__('Timezone (name) for Event times', 'event_espresso')
202
+			),
203
+			new GraphQLField(
204
+				'visibleOn',
205
+				'String',
206
+				'visible_on',
207
+				esc_html__('Event Visible Date', 'event_espresso')
208
+			),
209
+		];
210 210
 
211
-        return apply_filters(
212
-            'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields',
213
-            $fields,
214
-            $this->name,
215
-            $this->model
216
-        );
217
-    }
211
+		return apply_filters(
212
+			'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields',
213
+			$fields,
214
+			$this->name,
215
+			$this->model
216
+		);
217
+	}
218 218
 
219 219
 
220
-    /**
221
-     * Extends the existing WP GraphQL mutations.
222
-     *
223
-     * @since $VID:$
224
-     */
225
-    public function extendMutations()
226
-    {
227
-        add_action(
228
-            'graphql_post_object_mutation_update_additional_data',
229
-            EventUpdate::mutateFields($this->model, $this),
230
-            10,
231
-            6
232
-        );
233
-    }
220
+	/**
221
+	 * Extends the existing WP GraphQL mutations.
222
+	 *
223
+	 * @since $VID:$
224
+	 */
225
+	public function extendMutations()
226
+	{
227
+		add_action(
228
+			'graphql_post_object_mutation_update_additional_data',
229
+			EventUpdate::mutateFields($this->model, $this),
230
+			10,
231
+			6
232
+		);
233
+	}
234 234
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function __construct(EEM_Event $event_model)
30 30
     {
31 31
         $this->model = $event_model;
32
-        $this->setName($this->namespace . 'Event');
32
+        $this->setName($this->namespace.'Event');
33 33
         $this->setIsCustomPostType(true);
34 34
         parent::__construct();
35 35
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             ),
80 80
             new GraphQLOutputField(
81 81
                 'defaultRegStatus',
82
-                $this->namespace . 'RegistrationStatusEnum',
82
+                $this->namespace.'RegistrationStatusEnum',
83 83
                 'default_registration_status',
84 84
                 esc_html__('Default Event Registration Status', 'event_espresso')
85 85
             ),
Please login to merge, or discard this patch.
core/services/graphql/enums/EnumBase.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -13,91 +13,91 @@
 block discarded – undo
13 13
 abstract class EnumBase implements EnumInterface
14 14
 {
15 15
 
16
-    /**
17
-     * @var string $namespace The graphql namespace/prefix.
18
-     */
19
-    protected $namespace = 'Espresso';
20
-
21
-    /**
22
-     * @var string $name
23
-     */
24
-    protected $name = '';
25
-
26
-    /**
27
-     * @var string $description
28
-     */
29
-    protected $description = '';
30
-
31
-    /**
32
-     * @var array $values
33
-     */
34
-    protected $values = [];
35
-
36
-    /**
37
-     * EnumBase constructor.
38
-     */
39
-    public function __construct()
40
-    {
41
-        $this->setValues($this->getValues());
42
-    }
43
-
44
-
45
-    /**
46
-     * @return array
47
-     */
48
-    abstract protected function getValues(): array;
49
-
50
-
51
-    /**
52
-     * @return string
53
-     */
54
-    public function name(): string
55
-    {
56
-        return $this->name;
57
-    }
58
-
59
-
60
-    /**
61
-     * @param string $name
62
-     */
63
-    protected function setName(string $name)
64
-    {
65
-        $this->name = $name;
66
-    }
67
-
68
-
69
-    /**
70
-     * @return string
71
-     */
72
-    public function description(): string
73
-    {
74
-        return $this->description;
75
-    }
76
-
77
-
78
-    /**
79
-     * @param string $description
80
-     */
81
-    protected function setDescription(string $description)
82
-    {
83
-        $this->description = $description;
84
-    }
85
-
86
-
87
-    /**
88
-     * @return array
89
-     */
90
-    public function values(): array
91
-    {
92
-        return (array) $this->values;
93
-    }
94
-
95
-
96
-    /**
97
-     * @param array $values
98
-     */
99
-    protected function setValues(array $values)
100
-    {
101
-        $this->values = $values;
102
-    }
16
+	/**
17
+	 * @var string $namespace The graphql namespace/prefix.
18
+	 */
19
+	protected $namespace = 'Espresso';
20
+
21
+	/**
22
+	 * @var string $name
23
+	 */
24
+	protected $name = '';
25
+
26
+	/**
27
+	 * @var string $description
28
+	 */
29
+	protected $description = '';
30
+
31
+	/**
32
+	 * @var array $values
33
+	 */
34
+	protected $values = [];
35
+
36
+	/**
37
+	 * EnumBase constructor.
38
+	 */
39
+	public function __construct()
40
+	{
41
+		$this->setValues($this->getValues());
42
+	}
43
+
44
+
45
+	/**
46
+	 * @return array
47
+	 */
48
+	abstract protected function getValues(): array;
49
+
50
+
51
+	/**
52
+	 * @return string
53
+	 */
54
+	public function name(): string
55
+	{
56
+		return $this->name;
57
+	}
58
+
59
+
60
+	/**
61
+	 * @param string $name
62
+	 */
63
+	protected function setName(string $name)
64
+	{
65
+		$this->name = $name;
66
+	}
67
+
68
+
69
+	/**
70
+	 * @return string
71
+	 */
72
+	public function description(): string
73
+	{
74
+		return $this->description;
75
+	}
76
+
77
+
78
+	/**
79
+	 * @param string $description
80
+	 */
81
+	protected function setDescription(string $description)
82
+	{
83
+		$this->description = $description;
84
+	}
85
+
86
+
87
+	/**
88
+	 * @return array
89
+	 */
90
+	public function values(): array
91
+	{
92
+		return (array) $this->values;
93
+	}
94
+
95
+
96
+	/**
97
+	 * @param array $values
98
+	 */
99
+	protected function setValues(array $values)
100
+	{
101
+		$this->values = $values;
102
+	}
103 103
 }
Please login to merge, or discard this patch.