@@ -12,99 +12,99 @@ |
||
12 | 12 | */ |
13 | 13 | class Utilities |
14 | 14 | { |
15 | - /** |
|
16 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
17 | - * friendly keys. |
|
18 | - * |
|
19 | - * @param array $where_args |
|
20 | - * @param array $arg_mapping array where keys are GQL field names and values are EE modal field names |
|
21 | - * @param array $id_fields The fields to convert from global IDs to DB IDs. |
|
22 | - * @param array $options Additional parameters for modifying args: [ |
|
23 | - * 'include_all_args' => bool, // will return ALL args in $where_args if true |
|
24 | - * 'use_IN_operator' => bool, // arrays of IDs will use SQL IN clause if true |
|
25 | - * ] |
|
26 | - * @return array |
|
27 | - */ |
|
28 | - public function sanitizeWhereArgs( |
|
29 | - array $where_args, |
|
30 | - array $arg_mapping, |
|
31 | - array $id_fields, |
|
32 | - array $options = [] |
|
33 | - ): array { |
|
34 | - // if "include_all_args" is true, then the incoming $where_args array |
|
35 | - // will be copied to the outgoing $where_params prior to sanitizing the fields. |
|
36 | - // so ALL elements in the $where_args array will be present in the $where_params array |
|
37 | - $include_all_args = isset($options['include_all_args']) |
|
38 | - ? filter_var($options['include_all_args'], FILTER_VALIDATE_BOOLEAN) |
|
39 | - : false; |
|
40 | - // if "use_IN_operator" is true, then any ID args found in the $id_fields array |
|
41 | - // will have their values converted to use an SQL "IN" clause format |
|
42 | - // if the value returned from Relay::fromGlobalId() is an array of IDs |
|
43 | - $use_IN_operator = isset($options['use_IN_operator']) |
|
44 | - && filter_var($options['use_IN_operator'], FILTER_VALIDATE_BOOLEAN); |
|
45 | - $where_params = $include_all_args ? $where_args : []; |
|
46 | - foreach ($where_args as $arg => $value) { |
|
47 | - if (! array_key_exists($arg, $arg_mapping)) { |
|
48 | - continue; |
|
49 | - } |
|
50 | - if (is_array($value) && ! empty($value)) { |
|
51 | - $value = array_map( |
|
52 | - static function ($value) { |
|
53 | - if (is_string($value)) { |
|
54 | - $value = sanitize_text_field($value); |
|
55 | - } |
|
56 | - return $value; |
|
57 | - }, |
|
58 | - $value |
|
59 | - ); |
|
60 | - } elseif (is_string($value)) { |
|
61 | - $value = sanitize_text_field($value); |
|
62 | - } |
|
63 | - if (in_array($arg, $id_fields, true)) { |
|
64 | - $ID = $this->convertFromGlobalId($value); |
|
65 | - // Use the proper operator. |
|
66 | - $value = $use_IN_operator && is_array($ID) ? ['IN', $ID] : $ID; |
|
67 | - } |
|
68 | - $where_params[ $arg_mapping[ $arg ] ] = $value; |
|
69 | - } |
|
70 | - return $where_params; |
|
71 | - } |
|
15 | + /** |
|
16 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
17 | + * friendly keys. |
|
18 | + * |
|
19 | + * @param array $where_args |
|
20 | + * @param array $arg_mapping array where keys are GQL field names and values are EE modal field names |
|
21 | + * @param array $id_fields The fields to convert from global IDs to DB IDs. |
|
22 | + * @param array $options Additional parameters for modifying args: [ |
|
23 | + * 'include_all_args' => bool, // will return ALL args in $where_args if true |
|
24 | + * 'use_IN_operator' => bool, // arrays of IDs will use SQL IN clause if true |
|
25 | + * ] |
|
26 | + * @return array |
|
27 | + */ |
|
28 | + public function sanitizeWhereArgs( |
|
29 | + array $where_args, |
|
30 | + array $arg_mapping, |
|
31 | + array $id_fields, |
|
32 | + array $options = [] |
|
33 | + ): array { |
|
34 | + // if "include_all_args" is true, then the incoming $where_args array |
|
35 | + // will be copied to the outgoing $where_params prior to sanitizing the fields. |
|
36 | + // so ALL elements in the $where_args array will be present in the $where_params array |
|
37 | + $include_all_args = isset($options['include_all_args']) |
|
38 | + ? filter_var($options['include_all_args'], FILTER_VALIDATE_BOOLEAN) |
|
39 | + : false; |
|
40 | + // if "use_IN_operator" is true, then any ID args found in the $id_fields array |
|
41 | + // will have their values converted to use an SQL "IN" clause format |
|
42 | + // if the value returned from Relay::fromGlobalId() is an array of IDs |
|
43 | + $use_IN_operator = isset($options['use_IN_operator']) |
|
44 | + && filter_var($options['use_IN_operator'], FILTER_VALIDATE_BOOLEAN); |
|
45 | + $where_params = $include_all_args ? $where_args : []; |
|
46 | + foreach ($where_args as $arg => $value) { |
|
47 | + if (! array_key_exists($arg, $arg_mapping)) { |
|
48 | + continue; |
|
49 | + } |
|
50 | + if (is_array($value) && ! empty($value)) { |
|
51 | + $value = array_map( |
|
52 | + static function ($value) { |
|
53 | + if (is_string($value)) { |
|
54 | + $value = sanitize_text_field($value); |
|
55 | + } |
|
56 | + return $value; |
|
57 | + }, |
|
58 | + $value |
|
59 | + ); |
|
60 | + } elseif (is_string($value)) { |
|
61 | + $value = sanitize_text_field($value); |
|
62 | + } |
|
63 | + if (in_array($arg, $id_fields, true)) { |
|
64 | + $ID = $this->convertFromGlobalId($value); |
|
65 | + // Use the proper operator. |
|
66 | + $value = $use_IN_operator && is_array($ID) ? ['IN', $ID] : $ID; |
|
67 | + } |
|
68 | + $where_params[ $arg_mapping[ $arg ] ] = $value; |
|
69 | + } |
|
70 | + return $where_params; |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | - /** |
|
75 | - * Converts global ID to DB ID. |
|
76 | - * |
|
77 | - * @param string|string[] $ID |
|
78 | - * @return mixed |
|
79 | - */ |
|
80 | - public function convertFromGlobalId($ID) |
|
81 | - { |
|
82 | - if (is_array($ID)) { |
|
83 | - return array_map([$this, 'convertFromGlobalId'], $ID); |
|
84 | - } |
|
85 | - $parts = Relay::fromGlobalId($ID); |
|
86 | - return ! empty($parts['id']) ? $parts['id'] : null; |
|
87 | - } |
|
74 | + /** |
|
75 | + * Converts global ID to DB ID. |
|
76 | + * |
|
77 | + * @param string|string[] $ID |
|
78 | + * @return mixed |
|
79 | + */ |
|
80 | + public function convertFromGlobalId($ID) |
|
81 | + { |
|
82 | + if (is_array($ID)) { |
|
83 | + return array_map([$this, 'convertFromGlobalId'], $ID); |
|
84 | + } |
|
85 | + $parts = Relay::fromGlobalId($ID); |
|
86 | + return ! empty($parts['id']) ? $parts['id'] : null; |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | - /** |
|
91 | - * Convert the DB ID into GID |
|
92 | - * |
|
93 | - * @param string $type |
|
94 | - * @param int|int[] $ID |
|
95 | - * @return mixed |
|
96 | - */ |
|
97 | - public function convertToGlobalId(string $type, $ID) |
|
98 | - { |
|
99 | - $convertToGlobalId = [$this, 'convertToGlobalId']; |
|
100 | - if (is_array($ID)) { |
|
101 | - return array_map( |
|
102 | - static function ($id) use ($convertToGlobalId, $type) { |
|
103 | - return $convertToGlobalId($type, $id); |
|
104 | - }, |
|
105 | - $ID |
|
106 | - ); |
|
107 | - } |
|
108 | - return Relay::toGlobalId($type, $ID); |
|
109 | - } |
|
90 | + /** |
|
91 | + * Convert the DB ID into GID |
|
92 | + * |
|
93 | + * @param string $type |
|
94 | + * @param int|int[] $ID |
|
95 | + * @return mixed |
|
96 | + */ |
|
97 | + public function convertToGlobalId(string $type, $ID) |
|
98 | + { |
|
99 | + $convertToGlobalId = [$this, 'convertToGlobalId']; |
|
100 | + if (is_array($ID)) { |
|
101 | + return array_map( |
|
102 | + static function ($id) use ($convertToGlobalId, $type) { |
|
103 | + return $convertToGlobalId($type, $id); |
|
104 | + }, |
|
105 | + $ID |
|
106 | + ); |
|
107 | + } |
|
108 | + return Relay::toGlobalId($type, $ID); |
|
109 | + } |
|
110 | 110 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | && filter_var($options['use_IN_operator'], FILTER_VALIDATE_BOOLEAN); |
45 | 45 | $where_params = $include_all_args ? $where_args : []; |
46 | 46 | foreach ($where_args as $arg => $value) { |
47 | - if (! array_key_exists($arg, $arg_mapping)) { |
|
47 | + if ( ! array_key_exists($arg, $arg_mapping)) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | if (is_array($value) && ! empty($value)) { |
51 | 51 | $value = array_map( |
52 | - static function ($value) { |
|
52 | + static function($value) { |
|
53 | 53 | if (is_string($value)) { |
54 | 54 | $value = sanitize_text_field($value); |
55 | 55 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | // Use the proper operator. |
66 | 66 | $value = $use_IN_operator && is_array($ID) ? ['IN', $ID] : $ID; |
67 | 67 | } |
68 | - $where_params[ $arg_mapping[ $arg ] ] = $value; |
|
68 | + $where_params[$arg_mapping[$arg]] = $value; |
|
69 | 69 | } |
70 | 70 | return $where_params; |
71 | 71 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $convertToGlobalId = [$this, 'convertToGlobalId']; |
100 | 100 | if (is_array($ID)) { |
101 | 101 | return array_map( |
102 | - static function ($id) use ($convertToGlobalId, $type) { |
|
102 | + static function($id) use ($convertToGlobalId, $type) { |
|
103 | 103 | return $convertToGlobalId($type, $id); |
104 | 104 | }, |
105 | 105 | $ID |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function config(): array |
38 | 38 | { |
39 | 39 | return [ |
40 | - 'fromType' => $this->namespace . 'Datetime', |
|
41 | - 'toType' => $this->namespace . 'Ticket', |
|
40 | + 'fromType' => $this->namespace.'Datetime', |
|
41 | + 'toType' => $this->namespace.'Ticket', |
|
42 | 42 | 'fromFieldName' => 'tickets', |
43 | 43 | 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
44 | 44 | 'connectionArgs' => self::get_connection_args(), |
@@ -18,127 +18,127 @@ |
||
18 | 18 | */ |
19 | 19 | class DatetimeTicketsConnection extends ConnectionBase |
20 | 20 | { |
21 | - /** |
|
22 | - * DatetimeConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Ticket $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Ticket $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * DatetimeConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Ticket $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Ticket $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => $this->namespace . 'Datetime', |
|
39 | - 'toType' => $this->namespace . 'Ticket', |
|
40 | - 'fromFieldName' => 'tickets', |
|
41 | - 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
42 | - 'connectionArgs' => self::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => $this->namespace . 'Datetime', |
|
39 | + 'toType' => $this->namespace . 'Ticket', |
|
40 | + 'fromFieldName' => 'tickets', |
|
41 | + 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
42 | + 'connectionArgs' => self::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return array|Deferred|mixed |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function resolveConnection($entity, $args, $context, $info) |
|
57 | - { |
|
58 | - $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
59 | - return $resolver->get_connection(); |
|
60 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return array|Deferred|mixed |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function resolveConnection($entity, $args, $context, $info) |
|
57 | + { |
|
58 | + $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
59 | + return $resolver->get_connection(); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Given an optional array of args, this returns the args to be used in the connection |
|
64 | - * |
|
65 | - * @param array $args The args to modify the defaults |
|
66 | - * @return array |
|
67 | - */ |
|
68 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
69 | - public static function get_connection_args(array $args = []): array |
|
70 | - { |
|
71 | - $newArgs = [ |
|
72 | - 'orderby' => [ |
|
73 | - 'type' => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'], |
|
74 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
75 | - ], |
|
76 | - 'datetime' => [ |
|
77 | - 'type' => 'ID', |
|
78 | - 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
79 | - ], |
|
80 | - 'datetimeIn' => [ |
|
81 | - 'type' => ['list_of' => 'ID'], |
|
82 | - 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
83 | - ], |
|
84 | - 'datetimeId' => [ |
|
85 | - 'type' => 'Int', |
|
86 | - 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
87 | - ], |
|
88 | - 'datetimeIdIn' => [ |
|
89 | - 'type' => ['list_of' => 'Int'], |
|
90 | - 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
91 | - ], |
|
92 | - 'event' => [ |
|
93 | - 'type' => 'ID', |
|
94 | - 'description' => esc_html__('Globally unique event ID to get the tickets for.', 'event_espresso'), |
|
95 | - ], |
|
96 | - 'eventIn' => [ |
|
97 | - 'type' => ['list_of' => 'ID'], |
|
98 | - 'description' => esc_html__('Globally unique event IDs to get the tickets for.', 'event_espresso'), |
|
99 | - ], |
|
100 | - 'eventId' => [ |
|
101 | - 'type' => 'Int', |
|
102 | - 'description' => esc_html__('Event ID to get the tickets for.', 'event_espresso'), |
|
103 | - ], |
|
104 | - 'eventIdIn' => [ |
|
105 | - 'type' => ['list_of' => 'Int'], |
|
106 | - 'description' => esc_html__('Event IDs to get the tickets for.', 'event_espresso'), |
|
107 | - ], |
|
108 | - 'includeDefaultTickets' => [ |
|
109 | - 'type' => 'Boolean', |
|
110 | - 'description' => esc_html__('Whether to add default tickets to the list.', 'event_espresso'), |
|
111 | - ], |
|
112 | - 'search' => [ |
|
113 | - 'type' => 'String', |
|
114 | - 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
115 | - ], |
|
116 | - 'isDefault' => [ |
|
117 | - 'type' => 'Boolean', |
|
118 | - 'description' => esc_html__('Filter the default tickets', 'event_espresso'), |
|
119 | - ], |
|
120 | - 'isRequired' => [ |
|
121 | - 'type' => 'Boolean', |
|
122 | - 'description' => esc_html__('Filter the required tickets', 'event_espresso'), |
|
123 | - ], |
|
124 | - 'isTaxable' => [ |
|
125 | - 'type' => 'Boolean', |
|
126 | - 'description' => esc_html__('Filter the taxable tickets', 'event_espresso'), |
|
127 | - ], |
|
128 | - 'isTrashed' => [ |
|
129 | - 'type' => 'Boolean', |
|
130 | - 'description' => esc_html__('Filter the trashed tickets', 'event_espresso'), |
|
131 | - ], |
|
132 | - ]; |
|
62 | + /** |
|
63 | + * Given an optional array of args, this returns the args to be used in the connection |
|
64 | + * |
|
65 | + * @param array $args The args to modify the defaults |
|
66 | + * @return array |
|
67 | + */ |
|
68 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
69 | + public static function get_connection_args(array $args = []): array |
|
70 | + { |
|
71 | + $newArgs = [ |
|
72 | + 'orderby' => [ |
|
73 | + 'type' => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'], |
|
74 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
75 | + ], |
|
76 | + 'datetime' => [ |
|
77 | + 'type' => 'ID', |
|
78 | + 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
79 | + ], |
|
80 | + 'datetimeIn' => [ |
|
81 | + 'type' => ['list_of' => 'ID'], |
|
82 | + 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
83 | + ], |
|
84 | + 'datetimeId' => [ |
|
85 | + 'type' => 'Int', |
|
86 | + 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
87 | + ], |
|
88 | + 'datetimeIdIn' => [ |
|
89 | + 'type' => ['list_of' => 'Int'], |
|
90 | + 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
91 | + ], |
|
92 | + 'event' => [ |
|
93 | + 'type' => 'ID', |
|
94 | + 'description' => esc_html__('Globally unique event ID to get the tickets for.', 'event_espresso'), |
|
95 | + ], |
|
96 | + 'eventIn' => [ |
|
97 | + 'type' => ['list_of' => 'ID'], |
|
98 | + 'description' => esc_html__('Globally unique event IDs to get the tickets for.', 'event_espresso'), |
|
99 | + ], |
|
100 | + 'eventId' => [ |
|
101 | + 'type' => 'Int', |
|
102 | + 'description' => esc_html__('Event ID to get the tickets for.', 'event_espresso'), |
|
103 | + ], |
|
104 | + 'eventIdIn' => [ |
|
105 | + 'type' => ['list_of' => 'Int'], |
|
106 | + 'description' => esc_html__('Event IDs to get the tickets for.', 'event_espresso'), |
|
107 | + ], |
|
108 | + 'includeDefaultTickets' => [ |
|
109 | + 'type' => 'Boolean', |
|
110 | + 'description' => esc_html__('Whether to add default tickets to the list.', 'event_espresso'), |
|
111 | + ], |
|
112 | + 'search' => [ |
|
113 | + 'type' => 'String', |
|
114 | + 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
115 | + ], |
|
116 | + 'isDefault' => [ |
|
117 | + 'type' => 'Boolean', |
|
118 | + 'description' => esc_html__('Filter the default tickets', 'event_espresso'), |
|
119 | + ], |
|
120 | + 'isRequired' => [ |
|
121 | + 'type' => 'Boolean', |
|
122 | + 'description' => esc_html__('Filter the required tickets', 'event_espresso'), |
|
123 | + ], |
|
124 | + 'isTaxable' => [ |
|
125 | + 'type' => 'Boolean', |
|
126 | + 'description' => esc_html__('Filter the taxable tickets', 'event_espresso'), |
|
127 | + ], |
|
128 | + 'isTrashed' => [ |
|
129 | + 'type' => 'Boolean', |
|
130 | + 'description' => esc_html__('Filter the trashed tickets', 'event_espresso'), |
|
131 | + ], |
|
132 | + ]; |
|
133 | 133 | |
134 | - $newArgs = apply_filters( |
|
135 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args', |
|
136 | - $newArgs, |
|
137 | - $args |
|
138 | - ); |
|
139 | - return array_merge( |
|
140 | - $newArgs, |
|
141 | - $args |
|
142 | - ); |
|
143 | - } |
|
134 | + $newArgs = apply_filters( |
|
135 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args', |
|
136 | + $newArgs, |
|
137 | + $args |
|
138 | + ); |
|
139 | + return array_merge( |
|
140 | + $newArgs, |
|
141 | + $args |
|
142 | + ); |
|
143 | + } |
|
144 | 144 | } |
@@ -35,8 +35,8 @@ |
||
35 | 35 | public function config(): array |
36 | 36 | { |
37 | 37 | return [ |
38 | - 'fromType' => $this->namespace . 'Ticket', |
|
39 | - 'toType' => $this->namespace . 'Price', |
|
38 | + 'fromType' => $this->namespace.'Ticket', |
|
39 | + 'toType' => $this->namespace.'Price', |
|
40 | 40 | 'fromFieldName' => 'prices', |
41 | 41 | 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
42 | 42 | 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
@@ -18,132 +18,132 @@ |
||
18 | 18 | */ |
19 | 19 | class TicketPricesConnection extends ConnectionBase |
20 | 20 | { |
21 | - /** |
|
22 | - * TicketConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Price $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Price $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * TicketConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Price $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Price $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => $this->namespace . 'Ticket', |
|
39 | - 'toType' => $this->namespace . 'Price', |
|
40 | - 'fromFieldName' => 'prices', |
|
41 | - 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
42 | - 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => $this->namespace . 'Ticket', |
|
39 | + 'toType' => $this->namespace . 'Price', |
|
40 | + 'fromFieldName' => 'prices', |
|
41 | + 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
42 | + 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return array|Deferred|mixed |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function resolveConnection($entity, $args, $context, $info) |
|
57 | - { |
|
58 | - $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
59 | - return $resolver->get_connection(); |
|
60 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return array|Deferred|mixed |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function resolveConnection($entity, $args, $context, $info) |
|
57 | + { |
|
58 | + $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
59 | + return $resolver->get_connection(); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * Given an optional array of args, this returns the args to be used in the connection |
|
65 | - * |
|
66 | - * @param array $args The args to modify the defaults |
|
67 | - * @return array |
|
68 | - */ |
|
69 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
70 | - public static function get_connection_args(array $args = []): array |
|
71 | - { |
|
72 | - $newArgs = [ |
|
73 | - 'in' => [ |
|
74 | - 'type' => ['list_of' => 'ID'], |
|
75 | - 'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'), |
|
76 | - ], |
|
77 | - 'idIn' => [ |
|
78 | - 'type' => ['list_of' => 'ID'], |
|
79 | - 'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'), |
|
80 | - ], |
|
81 | - 'event' => [ |
|
82 | - 'type' => 'ID', |
|
83 | - 'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'), |
|
84 | - ], |
|
85 | - 'eventId' => [ |
|
86 | - 'type' => 'Int', |
|
87 | - 'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'), |
|
88 | - ], |
|
89 | - 'includeDefaultPrices' => [ |
|
90 | - 'type' => 'Boolean', |
|
91 | - 'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'), |
|
92 | - ], |
|
93 | - 'includeDefaultTicketsPrices' => [ |
|
94 | - 'type' => 'Boolean', |
|
95 | - 'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'), |
|
96 | - ], |
|
97 | - 'isDefault' => [ |
|
98 | - 'type' => 'Boolean', |
|
99 | - 'description' => esc_html__('Filter the default prices', 'event_espresso'), |
|
100 | - ], |
|
101 | - 'ticket' => [ |
|
102 | - 'type' => 'ID', |
|
103 | - 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
104 | - ], |
|
105 | - 'ticketIn' => [ |
|
106 | - 'type' => ['list_of' => 'ID'], |
|
107 | - 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
108 | - ], |
|
109 | - 'ticketId' => [ |
|
110 | - 'type' => 'Int', |
|
111 | - 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
112 | - ], |
|
113 | - 'ticketIdIn' => [ |
|
114 | - 'type' => ['list_of' => 'Int'], |
|
115 | - 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
116 | - ], |
|
117 | - 'priceType' => [ |
|
118 | - 'type' => 'ID', |
|
119 | - 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
120 | - ], |
|
121 | - 'priceTypeIn' => [ |
|
122 | - 'type' => ['list_of' => 'ID'], |
|
123 | - 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
124 | - ], |
|
125 | - 'priceTypeId' => [ |
|
126 | - 'type' => 'Int', |
|
127 | - 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
128 | - ], |
|
129 | - 'priceTypeIdIn' => [ |
|
130 | - 'type' => ['list_of' => 'Int'], |
|
131 | - 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
132 | - ], |
|
133 | - 'priceBaseTypeIn' => [ |
|
134 | - 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
135 | - 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
136 | - ], |
|
137 | - ]; |
|
63 | + /** |
|
64 | + * Given an optional array of args, this returns the args to be used in the connection |
|
65 | + * |
|
66 | + * @param array $args The args to modify the defaults |
|
67 | + * @return array |
|
68 | + */ |
|
69 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
70 | + public static function get_connection_args(array $args = []): array |
|
71 | + { |
|
72 | + $newArgs = [ |
|
73 | + 'in' => [ |
|
74 | + 'type' => ['list_of' => 'ID'], |
|
75 | + 'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'), |
|
76 | + ], |
|
77 | + 'idIn' => [ |
|
78 | + 'type' => ['list_of' => 'ID'], |
|
79 | + 'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'), |
|
80 | + ], |
|
81 | + 'event' => [ |
|
82 | + 'type' => 'ID', |
|
83 | + 'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'), |
|
84 | + ], |
|
85 | + 'eventId' => [ |
|
86 | + 'type' => 'Int', |
|
87 | + 'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'), |
|
88 | + ], |
|
89 | + 'includeDefaultPrices' => [ |
|
90 | + 'type' => 'Boolean', |
|
91 | + 'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'), |
|
92 | + ], |
|
93 | + 'includeDefaultTicketsPrices' => [ |
|
94 | + 'type' => 'Boolean', |
|
95 | + 'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'), |
|
96 | + ], |
|
97 | + 'isDefault' => [ |
|
98 | + 'type' => 'Boolean', |
|
99 | + 'description' => esc_html__('Filter the default prices', 'event_espresso'), |
|
100 | + ], |
|
101 | + 'ticket' => [ |
|
102 | + 'type' => 'ID', |
|
103 | + 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
104 | + ], |
|
105 | + 'ticketIn' => [ |
|
106 | + 'type' => ['list_of' => 'ID'], |
|
107 | + 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
108 | + ], |
|
109 | + 'ticketId' => [ |
|
110 | + 'type' => 'Int', |
|
111 | + 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
112 | + ], |
|
113 | + 'ticketIdIn' => [ |
|
114 | + 'type' => ['list_of' => 'Int'], |
|
115 | + 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
116 | + ], |
|
117 | + 'priceType' => [ |
|
118 | + 'type' => 'ID', |
|
119 | + 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
120 | + ], |
|
121 | + 'priceTypeIn' => [ |
|
122 | + 'type' => ['list_of' => 'ID'], |
|
123 | + 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
124 | + ], |
|
125 | + 'priceTypeId' => [ |
|
126 | + 'type' => 'Int', |
|
127 | + 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
128 | + ], |
|
129 | + 'priceTypeIdIn' => [ |
|
130 | + 'type' => ['list_of' => 'Int'], |
|
131 | + 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
132 | + ], |
|
133 | + 'priceBaseTypeIn' => [ |
|
134 | + 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
135 | + 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
136 | + ], |
|
137 | + ]; |
|
138 | 138 | |
139 | - $newArgs = apply_filters( |
|
140 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args', |
|
141 | - $newArgs, |
|
142 | - $args |
|
143 | - ); |
|
144 | - return array_merge( |
|
145 | - $newArgs, |
|
146 | - $args |
|
147 | - ); |
|
148 | - } |
|
139 | + $newArgs = apply_filters( |
|
140 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args', |
|
141 | + $newArgs, |
|
142 | + $args |
|
143 | + ); |
|
144 | + return array_merge( |
|
145 | + $newArgs, |
|
146 | + $args |
|
147 | + ); |
|
148 | + } |
|
149 | 149 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function config(): array |
38 | 38 | { |
39 | 39 | return [ |
40 | - 'fromType' => $this->namespace . 'Event', |
|
41 | - 'toType' => $this->namespace . 'Datetime', |
|
40 | + 'fromType' => $this->namespace.'Event', |
|
41 | + 'toType' => $this->namespace.'Datetime', |
|
42 | 42 | 'fromFieldName' => 'datetimes', |
43 | 43 | 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
44 | 44 | 'connectionArgs' => self::get_connection_args(), |
@@ -18,119 +18,119 @@ |
||
18 | 18 | */ |
19 | 19 | class EventDatetimesConnection extends ConnectionBase |
20 | 20 | { |
21 | - /** |
|
22 | - * DatetimeConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Datetime $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Datetime $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * DatetimeConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Datetime $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Datetime $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => $this->namespace . 'Event', |
|
39 | - 'toType' => $this->namespace . 'Datetime', |
|
40 | - 'fromFieldName' => 'datetimes', |
|
41 | - 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
42 | - 'connectionArgs' => self::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => $this->namespace . 'Event', |
|
39 | + 'toType' => $this->namespace . 'Datetime', |
|
40 | + 'fromFieldName' => 'datetimes', |
|
41 | + 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
42 | + 'connectionArgs' => self::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return array|Deferred|mixed |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function resolveConnection($entity, $args, $context, $info) |
|
57 | - { |
|
58 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
59 | - return $resolver->get_connection(); |
|
60 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return array|Deferred|mixed |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function resolveConnection($entity, $args, $context, $info) |
|
57 | + { |
|
58 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
59 | + return $resolver->get_connection(); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Given an optional array of args, this returns the args to be used in the connection |
|
64 | - * |
|
65 | - * @param array $args The args to modify the defaults |
|
66 | - * @return array |
|
67 | - */ |
|
68 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
69 | - public static function get_connection_args(array $args = []): array |
|
70 | - { |
|
71 | - $newArgs = [ |
|
72 | - 'orderby' => [ |
|
73 | - 'type' => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'], |
|
74 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
75 | - ], |
|
76 | - 'event' => [ |
|
77 | - 'type' => 'ID', |
|
78 | - 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
79 | - ], |
|
80 | - 'eventIn' => [ |
|
81 | - 'type' => ['list_of' => 'ID'], |
|
82 | - 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
83 | - ], |
|
84 | - 'eventId' => [ |
|
85 | - 'type' => 'Int', |
|
86 | - 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
87 | - ], |
|
88 | - 'eventIdIn' => [ |
|
89 | - 'type' => ['list_of' => 'Int'], |
|
90 | - 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
91 | - ], |
|
92 | - 'ticket' => [ |
|
93 | - 'type' => 'ID', |
|
94 | - 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
95 | - ], |
|
96 | - 'ticketIn' => [ |
|
97 | - 'type' => ['list_of' => 'ID'], |
|
98 | - 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
99 | - ], |
|
100 | - 'ticketId' => [ |
|
101 | - 'type' => 'Int', |
|
102 | - 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
103 | - ], |
|
104 | - 'ticketIdIn' => [ |
|
105 | - 'type' => ['list_of' => 'Int'], |
|
106 | - 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
107 | - ], |
|
108 | - 'upcoming' => [ |
|
109 | - 'type' => 'Boolean', |
|
110 | - 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
111 | - ], |
|
112 | - 'active' => [ |
|
113 | - 'type' => 'Boolean', |
|
114 | - 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
115 | - ], |
|
116 | - 'expired' => [ |
|
117 | - 'type' => 'Boolean', |
|
118 | - 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
119 | - ], |
|
120 | - 'search' => [ |
|
121 | - 'type' => 'String', |
|
122 | - 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
123 | - ], |
|
124 | - ]; |
|
62 | + /** |
|
63 | + * Given an optional array of args, this returns the args to be used in the connection |
|
64 | + * |
|
65 | + * @param array $args The args to modify the defaults |
|
66 | + * @return array |
|
67 | + */ |
|
68 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
69 | + public static function get_connection_args(array $args = []): array |
|
70 | + { |
|
71 | + $newArgs = [ |
|
72 | + 'orderby' => [ |
|
73 | + 'type' => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'], |
|
74 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
75 | + ], |
|
76 | + 'event' => [ |
|
77 | + 'type' => 'ID', |
|
78 | + 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
79 | + ], |
|
80 | + 'eventIn' => [ |
|
81 | + 'type' => ['list_of' => 'ID'], |
|
82 | + 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
83 | + ], |
|
84 | + 'eventId' => [ |
|
85 | + 'type' => 'Int', |
|
86 | + 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
87 | + ], |
|
88 | + 'eventIdIn' => [ |
|
89 | + 'type' => ['list_of' => 'Int'], |
|
90 | + 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
91 | + ], |
|
92 | + 'ticket' => [ |
|
93 | + 'type' => 'ID', |
|
94 | + 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
95 | + ], |
|
96 | + 'ticketIn' => [ |
|
97 | + 'type' => ['list_of' => 'ID'], |
|
98 | + 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
99 | + ], |
|
100 | + 'ticketId' => [ |
|
101 | + 'type' => 'Int', |
|
102 | + 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
103 | + ], |
|
104 | + 'ticketIdIn' => [ |
|
105 | + 'type' => ['list_of' => 'Int'], |
|
106 | + 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
107 | + ], |
|
108 | + 'upcoming' => [ |
|
109 | + 'type' => 'Boolean', |
|
110 | + 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
111 | + ], |
|
112 | + 'active' => [ |
|
113 | + 'type' => 'Boolean', |
|
114 | + 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
115 | + ], |
|
116 | + 'expired' => [ |
|
117 | + 'type' => 'Boolean', |
|
118 | + 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
119 | + ], |
|
120 | + 'search' => [ |
|
121 | + 'type' => 'String', |
|
122 | + 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
123 | + ], |
|
124 | + ]; |
|
125 | 125 | |
126 | - $newArgs = apply_filters( |
|
127 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__datetime_args', |
|
128 | - $newArgs, |
|
129 | - $args |
|
130 | - ); |
|
131 | - return array_merge( |
|
132 | - $newArgs, |
|
133 | - $args |
|
134 | - ); |
|
135 | - } |
|
126 | + $newArgs = apply_filters( |
|
127 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__datetime_args', |
|
128 | + $newArgs, |
|
129 | + $args |
|
130 | + ); |
|
131 | + return array_merge( |
|
132 | + $newArgs, |
|
133 | + $args |
|
134 | + ); |
|
135 | + } |
|
136 | 136 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'FormElement', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'FormElements', |
|
41 | + 'toType' => $this->namespace.'FormElement', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'FormElements', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryFormElementsConnection", |
44 | 44 | 'connectionArgs' => $this->get_connection_args(), |
45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ), |
79 | 79 | ], |
80 | 80 | 'status' => [ |
81 | - 'type' => ['list_of' => $this->namespace . 'FormSectionStatusEnum'], |
|
81 | + 'type' => ['list_of' => $this->namespace.'FormSectionStatusEnum'], |
|
82 | 82 | 'description' => esc_html__( |
83 | 83 | 'Filter the form elements by status.', |
84 | 84 | 'event_espresso' |
@@ -18,80 +18,80 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryFormElementsConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * FormElementConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Form_Element $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Form_Element $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * FormElementConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Form_Element $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Form_Element $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'FormElement', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'FormElements', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryFormElementsConnection", |
|
42 | - 'connectionArgs' => $this->get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'FormElement', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'FormElements', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryFormElementsConnection", |
|
42 | + 'connectionArgs' => $this->get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return FormElementConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new FormElementConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return FormElementConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new FormElementConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Given an optional array of args, this returns the args to be used in the connection |
|
63 | - * |
|
64 | - * @param array $args The args to modify the defaults |
|
65 | - * @return array |
|
66 | - */ |
|
67 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | - public function get_connection_args(array $args = []): array |
|
69 | - { |
|
70 | - $newArgs = [ |
|
71 | - 'belongsTo' => [ |
|
72 | - 'type' => ['list_of' => 'ID'], |
|
73 | - 'description' => esc_html__( |
|
74 | - 'Related entity IDs to get the form elements for.', |
|
75 | - 'event_espresso' |
|
76 | - ), |
|
77 | - ], |
|
78 | - 'status' => [ |
|
79 | - 'type' => ['list_of' => $this->namespace . 'FormSectionStatusEnum'], |
|
80 | - 'description' => esc_html__( |
|
81 | - 'Filter the form elements by status.', |
|
82 | - 'event_espresso' |
|
83 | - ), |
|
84 | - ], |
|
85 | - ]; |
|
61 | + /** |
|
62 | + * Given an optional array of args, this returns the args to be used in the connection |
|
63 | + * |
|
64 | + * @param array $args The args to modify the defaults |
|
65 | + * @return array |
|
66 | + */ |
|
67 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | + public function get_connection_args(array $args = []): array |
|
69 | + { |
|
70 | + $newArgs = [ |
|
71 | + 'belongsTo' => [ |
|
72 | + 'type' => ['list_of' => 'ID'], |
|
73 | + 'description' => esc_html__( |
|
74 | + 'Related entity IDs to get the form elements for.', |
|
75 | + 'event_espresso' |
|
76 | + ), |
|
77 | + ], |
|
78 | + 'status' => [ |
|
79 | + 'type' => ['list_of' => $this->namespace . 'FormSectionStatusEnum'], |
|
80 | + 'description' => esc_html__( |
|
81 | + 'Filter the form elements by status.', |
|
82 | + 'event_espresso' |
|
83 | + ), |
|
84 | + ], |
|
85 | + ]; |
|
86 | 86 | |
87 | - $newArgs = apply_filters( |
|
88 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__form_element_args', |
|
89 | - $newArgs, |
|
90 | - $args |
|
91 | - ); |
|
92 | - return array_merge( |
|
93 | - $newArgs, |
|
94 | - $args |
|
95 | - ); |
|
96 | - } |
|
87 | + $newArgs = apply_filters( |
|
88 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__form_element_args', |
|
89 | + $newArgs, |
|
90 | + $args |
|
91 | + ); |
|
92 | + return array_merge( |
|
93 | + $newArgs, |
|
94 | + $args |
|
95 | + ); |
|
96 | + } |
|
97 | 97 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'FormSection', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'FormSections', |
|
41 | + 'toType' => $this->namespace.'FormSection', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'FormSections', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryFormSectionsConnection", |
44 | 44 | 'connectionArgs' => $this->get_connection_args(), |
45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | $newArgs = [ |
73 | 73 | 'appliesTo' => [ |
74 | - 'type' => ['list_of' => $this->namespace . 'FormSectionAppliesToEnum'], |
|
74 | + 'type' => ['list_of' => $this->namespace.'FormSectionAppliesToEnum'], |
|
75 | 75 | 'description' => esc_html__( |
76 | 76 | 'Form user types to get the form sections for.', |
77 | 77 | 'event_espresso' |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ), |
86 | 86 | ], |
87 | 87 | 'status' => [ |
88 | - 'type' => ['list_of' => $this->namespace . 'FormSectionStatusEnum'], |
|
88 | + 'type' => ['list_of' => $this->namespace.'FormSectionStatusEnum'], |
|
89 | 89 | 'description' => esc_html__( |
90 | 90 | 'Filter the form sections by status.', |
91 | 91 | 'event_espresso' |
@@ -18,87 +18,87 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryFormSectionsConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * FormSectionConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Form_Section $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Form_Section $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * FormSectionConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Form_Section $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Form_Section $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'FormSection', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'FormSections', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryFormSectionsConnection", |
|
42 | - 'connectionArgs' => $this->get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'FormSection', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'FormSections', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryFormSectionsConnection", |
|
42 | + 'connectionArgs' => $this->get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return FormSectionConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new FormSectionConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return FormSectionConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new FormSectionConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Given an optional array of args, this returns the args to be used in the connection |
|
63 | - * |
|
64 | - * @param array $args The args to modify the defaults |
|
65 | - * @return array |
|
66 | - */ |
|
67 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | - public function get_connection_args(array $args = []): array |
|
69 | - { |
|
70 | - $newArgs = [ |
|
71 | - 'appliesTo' => [ |
|
72 | - 'type' => ['list_of' => $this->namespace . 'FormSectionAppliesToEnum'], |
|
73 | - 'description' => esc_html__( |
|
74 | - 'Form user types to get the form sections for.', |
|
75 | - 'event_espresso' |
|
76 | - ), |
|
77 | - ], |
|
78 | - 'belongsTo' => [ |
|
79 | - 'type' => ['list_of' => 'ID'], |
|
80 | - 'description' => esc_html__( |
|
81 | - 'Related entity IDs to get the form sections for.', |
|
82 | - 'event_espresso' |
|
83 | - ), |
|
84 | - ], |
|
85 | - 'status' => [ |
|
86 | - 'type' => ['list_of' => $this->namespace . 'FormSectionStatusEnum'], |
|
87 | - 'description' => esc_html__( |
|
88 | - 'Filter the form sections by status.', |
|
89 | - 'event_espresso' |
|
90 | - ), |
|
91 | - ], |
|
92 | - ]; |
|
61 | + /** |
|
62 | + * Given an optional array of args, this returns the args to be used in the connection |
|
63 | + * |
|
64 | + * @param array $args The args to modify the defaults |
|
65 | + * @return array |
|
66 | + */ |
|
67 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | + public function get_connection_args(array $args = []): array |
|
69 | + { |
|
70 | + $newArgs = [ |
|
71 | + 'appliesTo' => [ |
|
72 | + 'type' => ['list_of' => $this->namespace . 'FormSectionAppliesToEnum'], |
|
73 | + 'description' => esc_html__( |
|
74 | + 'Form user types to get the form sections for.', |
|
75 | + 'event_espresso' |
|
76 | + ), |
|
77 | + ], |
|
78 | + 'belongsTo' => [ |
|
79 | + 'type' => ['list_of' => 'ID'], |
|
80 | + 'description' => esc_html__( |
|
81 | + 'Related entity IDs to get the form sections for.', |
|
82 | + 'event_espresso' |
|
83 | + ), |
|
84 | + ], |
|
85 | + 'status' => [ |
|
86 | + 'type' => ['list_of' => $this->namespace . 'FormSectionStatusEnum'], |
|
87 | + 'description' => esc_html__( |
|
88 | + 'Filter the form sections by status.', |
|
89 | + 'event_espresso' |
|
90 | + ), |
|
91 | + ], |
|
92 | + ]; |
|
93 | 93 | |
94 | - $newArgs = apply_filters( |
|
95 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__form_section_args', |
|
96 | - $newArgs, |
|
97 | - $args |
|
98 | - ); |
|
99 | - return array_merge( |
|
100 | - $newArgs, |
|
101 | - $args |
|
102 | - ); |
|
103 | - } |
|
94 | + $newArgs = apply_filters( |
|
95 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__form_section_args', |
|
96 | + $newArgs, |
|
97 | + $args |
|
98 | + ); |
|
99 | + return array_merge( |
|
100 | + $newArgs, |
|
101 | + $args |
|
102 | + ); |
|
103 | + } |
|
104 | 104 | } |
@@ -36,8 +36,8 @@ |
||
36 | 36 | public function config(): array |
37 | 37 | { |
38 | 38 | return [ |
39 | - 'fromType' => $this->namespace . 'Ticket', |
|
40 | - 'toType' => $this->namespace . 'Datetime', |
|
39 | + 'fromType' => $this->namespace.'Ticket', |
|
40 | + 'toType' => $this->namespace.'Datetime', |
|
41 | 41 | 'fromFieldName' => 'datetimes', |
42 | 42 | 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
43 | 43 | 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
@@ -18,44 +18,44 @@ |
||
18 | 18 | */ |
19 | 19 | class TicketDatetimesConnection extends ConnectionBase |
20 | 20 | { |
21 | - /** |
|
22 | - * DatetimeConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Datetime $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Datetime $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * DatetimeConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Datetime $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Datetime $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => $this->namespace . 'Ticket', |
|
39 | - 'toType' => $this->namespace . 'Datetime', |
|
40 | - 'fromFieldName' => 'datetimes', |
|
41 | - 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
|
42 | - 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => $this->namespace . 'Ticket', |
|
39 | + 'toType' => $this->namespace . 'Datetime', |
|
40 | + 'fromFieldName' => 'datetimes', |
|
41 | + 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
|
42 | + 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return array|Deferred|mixed |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function resolveConnection($entity, $args, $context, $info) |
|
57 | - { |
|
58 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
59 | - return $resolver->get_connection(); |
|
60 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return array|Deferred|mixed |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function resolveConnection($entity, $args, $context, $info) |
|
57 | + { |
|
58 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
59 | + return $resolver->get_connection(); |
|
60 | + } |
|
61 | 61 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function config(): array |
38 | 38 | { |
39 | 39 | return [ |
40 | - 'fromType' => $this->namespace . 'Event', |
|
41 | - 'toType' => $this->namespace . 'Venue', |
|
40 | + 'fromType' => $this->namespace.'Event', |
|
41 | + 'toType' => $this->namespace.'Venue', |
|
42 | 42 | 'fromFieldName' => 'venues', |
43 | 43 | 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
44 | 44 | 'resolve' => [$this, 'resolveConnection'], |
@@ -18,43 +18,43 @@ |
||
18 | 18 | */ |
19 | 19 | class EventVenuesConnection extends ConnectionBase |
20 | 20 | { |
21 | - /** |
|
22 | - * DatetimeConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Venue $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Venue $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * DatetimeConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Venue $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Venue $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => $this->namespace . 'Event', |
|
39 | - 'toType' => $this->namespace . 'Venue', |
|
40 | - 'fromFieldName' => 'venues', |
|
41 | - 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
|
42 | - 'resolve' => [$this, 'resolveConnection'], |
|
43 | - ]; |
|
44 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => $this->namespace . 'Event', |
|
39 | + 'toType' => $this->namespace . 'Venue', |
|
40 | + 'fromFieldName' => 'venues', |
|
41 | + 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
|
42 | + 'resolve' => [$this, 'resolveConnection'], |
|
43 | + ]; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * @param $entity |
|
49 | - * @param $args |
|
50 | - * @param $context |
|
51 | - * @param $info |
|
52 | - * @return array|Deferred|mixed |
|
53 | - * @throws Exception |
|
54 | - */ |
|
55 | - public function resolveConnection($entity, $args, $context, $info) |
|
56 | - { |
|
57 | - $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
58 | - return $resolver->get_connection(); |
|
59 | - } |
|
47 | + /** |
|
48 | + * @param $entity |
|
49 | + * @param $args |
|
50 | + * @param $context |
|
51 | + * @param $info |
|
52 | + * @return array|Deferred|mixed |
|
53 | + * @throws Exception |
|
54 | + */ |
|
55 | + public function resolveConnection($entity, $args, $context, $info) |
|
56 | + { |
|
57 | + $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
58 | + return $resolver->get_connection(); |
|
59 | + } |
|
60 | 60 | } |
@@ -15,27 +15,27 @@ |
||
15 | 15 | */ |
16 | 16 | class PriceTypeLoader extends AbstractLoader |
17 | 17 | { |
18 | - /** |
|
19 | - * @return EEM_Base |
|
20 | - * @throws EE_Error |
|
21 | - * @throws InvalidArgumentException |
|
22 | - * @throws InvalidDataTypeException |
|
23 | - * @throws InvalidInterfaceException |
|
24 | - * @throws ReflectionException |
|
25 | - */ |
|
26 | - protected function getQuery(): EEM_Base |
|
27 | - { |
|
28 | - return EEM_Price_Type::instance(); |
|
29 | - } |
|
18 | + /** |
|
19 | + * @return EEM_Base |
|
20 | + * @throws EE_Error |
|
21 | + * @throws InvalidArgumentException |
|
22 | + * @throws InvalidDataTypeException |
|
23 | + * @throws InvalidInterfaceException |
|
24 | + * @throws ReflectionException |
|
25 | + */ |
|
26 | + protected function getQuery(): EEM_Base |
|
27 | + { |
|
28 | + return EEM_Price_Type::instance(); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * @param array $keys |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - protected function getWhereParams(array $keys): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'PRT_ID' => ['IN', $keys], |
|
39 | - ]; |
|
40 | - } |
|
31 | + /** |
|
32 | + * @param array $keys |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + protected function getWhereParams(array $keys): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'PRT_ID' => ['IN', $keys], |
|
39 | + ]; |
|
40 | + } |
|
41 | 41 | } |