@@ -18,181 +18,181 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class DatetimeConnectionResolver extends AbstractConnectionResolver |
| 20 | 20 | { |
| 21 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 22 | - public function get_loader_name() |
|
| 23 | - { |
|
| 24 | - return 'espresso_datetime'; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @return EEM_Datetime |
|
| 29 | - * @throws EE_Error |
|
| 30 | - * @throws InvalidArgumentException |
|
| 31 | - * @throws InvalidDataTypeException |
|
| 32 | - * @throws InvalidInterfaceException |
|
| 33 | - */ |
|
| 34 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 35 | - public function get_query() |
|
| 36 | - { |
|
| 37 | - return EEM_Datetime::instance(); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Return an array of item IDs from the query |
|
| 42 | - * |
|
| 43 | - * @return array |
|
| 44 | - */ |
|
| 45 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 46 | - public function get_ids() |
|
| 47 | - { |
|
| 48 | - $results = $this->query->get_col($this->query_args); |
|
| 49 | - |
|
| 50 | - return ! empty($results) ? $results : []; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Here, we map the args from the input, then we make sure that we're only querying |
|
| 55 | - * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
| 56 | - * handle batch resolution of the posts. |
|
| 57 | - * |
|
| 58 | - * @return array |
|
| 59 | - * @throws EE_Error |
|
| 60 | - * @throws InvalidArgumentException |
|
| 61 | - * @throws InvalidDataTypeException |
|
| 62 | - * @throws InvalidInterfaceException |
|
| 63 | - */ |
|
| 64 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 65 | - public function get_query_args() |
|
| 66 | - { |
|
| 67 | - $where_params = ['DTT_deleted' => ['IN', [true, false]]]; |
|
| 68 | - $query_args = []; |
|
| 69 | - |
|
| 70 | - $query_args['limit'] = $this->getLimit(); |
|
| 71 | - |
|
| 72 | - // Avoid multiple entries by join. |
|
| 73 | - $query_args['group_by'] = 'DTT_ID'; |
|
| 74 | - |
|
| 75 | - $query_args['default_where_conditions'] = 'minimum'; |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
| 79 | - */ |
|
| 80 | - $input_fields = []; |
|
| 81 | - if (! empty($this->args['where'])) { |
|
| 82 | - $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
| 83 | - |
|
| 84 | - // Use the proper operator. |
|
| 85 | - if (! empty($input_fields['EVT_ID']) && is_array($input_fields['EVT_ID'])) { |
|
| 86 | - $input_fields['EVT_ID'] = ['in', $input_fields['EVT_ID']]; |
|
| 87 | - } |
|
| 88 | - if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) { |
|
| 89 | - $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']]; |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Determine where we're at in the Graph and adjust the query context appropriately. |
|
| 95 | - * |
|
| 96 | - * For example, if we're querying for datetime as a field of event query, this will automatically |
|
| 97 | - * set the query to pull datetimes that belong to that event. |
|
| 98 | - * We can set more cases for other source types. |
|
| 99 | - */ |
|
| 100 | - if (is_object($this->source)) { |
|
| 101 | - switch (true) { |
|
| 102 | - // It's surely an event |
|
| 103 | - case $this->source instanceof Post: |
|
| 104 | - $where_params['EVT_ID'] = $this->source->ID; |
|
| 105 | - break; |
|
| 106 | - case $this->source instanceof EE_Event: |
|
| 107 | - $where_params['EVT_ID'] = $this->source->ID(); |
|
| 108 | - break; |
|
| 109 | - case $this->source instanceof EE_Ticket: |
|
| 110 | - $where_params['Ticket.TKT_ID'] = $this->source->ID(); |
|
| 111 | - break; |
|
| 112 | - case $this->source instanceof EE_Checkin: |
|
| 113 | - $where_params['Checkin.CHK_ID'] = $this->source->ID(); |
|
| 114 | - break; |
|
| 115 | - } |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Merge the input_fields with the default query_args |
|
| 120 | - */ |
|
| 121 | - if (! empty($input_fields)) { |
|
| 122 | - $where_params = array_merge($where_params, $input_fields); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'DTT_ID'); |
|
| 126 | - |
|
| 127 | - if (! empty($this->args['where']['upcoming'])) { |
|
| 128 | - $where_params['DTT_EVT_start'] = array( |
|
| 129 | - '>', |
|
| 130 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start') |
|
| 131 | - ); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - if (! empty($this->args['where']['active'])) { |
|
| 135 | - $where_params['DTT_EVT_start'] = array( |
|
| 136 | - '<', |
|
| 137 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start') |
|
| 138 | - ); |
|
| 139 | - $where_params['DTT_EVT_end'] = array( |
|
| 140 | - '>', |
|
| 141 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end') |
|
| 142 | - ); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - if (! empty($this->args['where']['expired'])) { |
|
| 146 | - $where_params['DTT_EVT_end'] = array( |
|
| 147 | - '<', |
|
| 148 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end') |
|
| 149 | - ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - $where_params = apply_filters( |
|
| 153 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__datetime_where_params', |
|
| 154 | - $where_params, |
|
| 155 | - $this->source, |
|
| 156 | - $this->args |
|
| 157 | - ); |
|
| 158 | - |
|
| 159 | - $query_args[] = $where_params; |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Return the $query_args |
|
| 163 | - */ |
|
| 164 | - return apply_filters( |
|
| 165 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__datetime_query_args', |
|
| 166 | - $query_args, |
|
| 167 | - $this->source, |
|
| 168 | - $this->args |
|
| 169 | - ); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 175 | - * friendly keys. |
|
| 176 | - * |
|
| 177 | - * @param array $where_args |
|
| 178 | - * @return array |
|
| 179 | - */ |
|
| 180 | - public function sanitizeInputFields(array $where_args) |
|
| 181 | - { |
|
| 182 | - $arg_mapping = [ |
|
| 183 | - 'event' => 'EVT_ID', |
|
| 184 | - 'eventIn' => 'EVT_ID', |
|
| 185 | - 'eventId' => 'EVT_ID', |
|
| 186 | - 'eventIdIn' => 'EVT_ID', |
|
| 187 | - 'ticket' => 'Ticket.TKT_ID', |
|
| 188 | - 'ticketIn' => 'Ticket.TKT_ID', |
|
| 189 | - 'ticketId' => 'Ticket.TKT_ID', |
|
| 190 | - 'ticketIdIn' => 'Ticket.TKT_ID', |
|
| 191 | - ]; |
|
| 192 | - return $this->sanitizeWhereArgsForInputFields( |
|
| 193 | - $where_args, |
|
| 194 | - $arg_mapping, |
|
| 195 | - ['event', 'eventIn', 'ticket', 'ticketIn'] |
|
| 196 | - ); |
|
| 197 | - } |
|
| 21 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 22 | + public function get_loader_name() |
|
| 23 | + { |
|
| 24 | + return 'espresso_datetime'; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @return EEM_Datetime |
|
| 29 | + * @throws EE_Error |
|
| 30 | + * @throws InvalidArgumentException |
|
| 31 | + * @throws InvalidDataTypeException |
|
| 32 | + * @throws InvalidInterfaceException |
|
| 33 | + */ |
|
| 34 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 35 | + public function get_query() |
|
| 36 | + { |
|
| 37 | + return EEM_Datetime::instance(); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Return an array of item IDs from the query |
|
| 42 | + * |
|
| 43 | + * @return array |
|
| 44 | + */ |
|
| 45 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 46 | + public function get_ids() |
|
| 47 | + { |
|
| 48 | + $results = $this->query->get_col($this->query_args); |
|
| 49 | + |
|
| 50 | + return ! empty($results) ? $results : []; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Here, we map the args from the input, then we make sure that we're only querying |
|
| 55 | + * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
| 56 | + * handle batch resolution of the posts. |
|
| 57 | + * |
|
| 58 | + * @return array |
|
| 59 | + * @throws EE_Error |
|
| 60 | + * @throws InvalidArgumentException |
|
| 61 | + * @throws InvalidDataTypeException |
|
| 62 | + * @throws InvalidInterfaceException |
|
| 63 | + */ |
|
| 64 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 65 | + public function get_query_args() |
|
| 66 | + { |
|
| 67 | + $where_params = ['DTT_deleted' => ['IN', [true, false]]]; |
|
| 68 | + $query_args = []; |
|
| 69 | + |
|
| 70 | + $query_args['limit'] = $this->getLimit(); |
|
| 71 | + |
|
| 72 | + // Avoid multiple entries by join. |
|
| 73 | + $query_args['group_by'] = 'DTT_ID'; |
|
| 74 | + |
|
| 75 | + $query_args['default_where_conditions'] = 'minimum'; |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
| 79 | + */ |
|
| 80 | + $input_fields = []; |
|
| 81 | + if (! empty($this->args['where'])) { |
|
| 82 | + $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
| 83 | + |
|
| 84 | + // Use the proper operator. |
|
| 85 | + if (! empty($input_fields['EVT_ID']) && is_array($input_fields['EVT_ID'])) { |
|
| 86 | + $input_fields['EVT_ID'] = ['in', $input_fields['EVT_ID']]; |
|
| 87 | + } |
|
| 88 | + if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) { |
|
| 89 | + $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']]; |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Determine where we're at in the Graph and adjust the query context appropriately. |
|
| 95 | + * |
|
| 96 | + * For example, if we're querying for datetime as a field of event query, this will automatically |
|
| 97 | + * set the query to pull datetimes that belong to that event. |
|
| 98 | + * We can set more cases for other source types. |
|
| 99 | + */ |
|
| 100 | + if (is_object($this->source)) { |
|
| 101 | + switch (true) { |
|
| 102 | + // It's surely an event |
|
| 103 | + case $this->source instanceof Post: |
|
| 104 | + $where_params['EVT_ID'] = $this->source->ID; |
|
| 105 | + break; |
|
| 106 | + case $this->source instanceof EE_Event: |
|
| 107 | + $where_params['EVT_ID'] = $this->source->ID(); |
|
| 108 | + break; |
|
| 109 | + case $this->source instanceof EE_Ticket: |
|
| 110 | + $where_params['Ticket.TKT_ID'] = $this->source->ID(); |
|
| 111 | + break; |
|
| 112 | + case $this->source instanceof EE_Checkin: |
|
| 113 | + $where_params['Checkin.CHK_ID'] = $this->source->ID(); |
|
| 114 | + break; |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Merge the input_fields with the default query_args |
|
| 120 | + */ |
|
| 121 | + if (! empty($input_fields)) { |
|
| 122 | + $where_params = array_merge($where_params, $input_fields); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'DTT_ID'); |
|
| 126 | + |
|
| 127 | + if (! empty($this->args['where']['upcoming'])) { |
|
| 128 | + $where_params['DTT_EVT_start'] = array( |
|
| 129 | + '>', |
|
| 130 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start') |
|
| 131 | + ); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + if (! empty($this->args['where']['active'])) { |
|
| 135 | + $where_params['DTT_EVT_start'] = array( |
|
| 136 | + '<', |
|
| 137 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start') |
|
| 138 | + ); |
|
| 139 | + $where_params['DTT_EVT_end'] = array( |
|
| 140 | + '>', |
|
| 141 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end') |
|
| 142 | + ); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + if (! empty($this->args['where']['expired'])) { |
|
| 146 | + $where_params['DTT_EVT_end'] = array( |
|
| 147 | + '<', |
|
| 148 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end') |
|
| 149 | + ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + $where_params = apply_filters( |
|
| 153 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__datetime_where_params', |
|
| 154 | + $where_params, |
|
| 155 | + $this->source, |
|
| 156 | + $this->args |
|
| 157 | + ); |
|
| 158 | + |
|
| 159 | + $query_args[] = $where_params; |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Return the $query_args |
|
| 163 | + */ |
|
| 164 | + return apply_filters( |
|
| 165 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__datetime_query_args', |
|
| 166 | + $query_args, |
|
| 167 | + $this->source, |
|
| 168 | + $this->args |
|
| 169 | + ); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 175 | + * friendly keys. |
|
| 176 | + * |
|
| 177 | + * @param array $where_args |
|
| 178 | + * @return array |
|
| 179 | + */ |
|
| 180 | + public function sanitizeInputFields(array $where_args) |
|
| 181 | + { |
|
| 182 | + $arg_mapping = [ |
|
| 183 | + 'event' => 'EVT_ID', |
|
| 184 | + 'eventIn' => 'EVT_ID', |
|
| 185 | + 'eventId' => 'EVT_ID', |
|
| 186 | + 'eventIdIn' => 'EVT_ID', |
|
| 187 | + 'ticket' => 'Ticket.TKT_ID', |
|
| 188 | + 'ticketIn' => 'Ticket.TKT_ID', |
|
| 189 | + 'ticketId' => 'Ticket.TKT_ID', |
|
| 190 | + 'ticketIdIn' => 'Ticket.TKT_ID', |
|
| 191 | + ]; |
|
| 192 | + return $this->sanitizeWhereArgsForInputFields( |
|
| 193 | + $where_args, |
|
| 194 | + $arg_mapping, |
|
| 195 | + ['event', 'eventIn', 'ticket', 'ticketIn'] |
|
| 196 | + ); |
|
| 197 | + } |
|
| 198 | 198 | } |
@@ -15,134 +15,134 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class TicketConnectionResolver extends AbstractConnectionResolver |
| 17 | 17 | { |
| 18 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 19 | - public function get_loader_name() |
|
| 20 | - { |
|
| 21 | - return 'espresso_ticket'; |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @return EEM_Ticket |
|
| 26 | - * @throws EE_Error |
|
| 27 | - * @throws InvalidArgumentException |
|
| 28 | - * @throws InvalidDataTypeException |
|
| 29 | - * @throws InvalidInterfaceException |
|
| 30 | - */ |
|
| 31 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 32 | - public function get_query() |
|
| 33 | - { |
|
| 34 | - return EEM_Ticket::instance(); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Return an array of item IDs from the query |
|
| 40 | - * |
|
| 41 | - * @return array |
|
| 42 | - */ |
|
| 43 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 44 | - public function get_ids() |
|
| 45 | - { |
|
| 46 | - $results = $this->query->get_col($this->query_args); |
|
| 47 | - |
|
| 48 | - return ! empty($results) ? $results : []; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Here, we map the args from the input, then we make sure that we're only querying |
|
| 54 | - * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
| 55 | - * handle batch resolution of the posts. |
|
| 56 | - * |
|
| 57 | - * @return array |
|
| 58 | - * @throws EE_Error |
|
| 59 | - * @throws InvalidArgumentException |
|
| 60 | - * @throws ReflectionException |
|
| 61 | - * @throws InvalidDataTypeException |
|
| 62 | - * @throws InvalidInterfaceException |
|
| 63 | - */ |
|
| 64 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 65 | - public function get_query_args() |
|
| 66 | - { |
|
| 67 | - $where_params = ['TKT_deleted' => ['IN', [true, false]]]; |
|
| 68 | - $query_args = []; |
|
| 69 | - |
|
| 70 | - $query_args['limit'] = $this->getLimit(); |
|
| 71 | - |
|
| 72 | - // Avoid multiple entries by join. |
|
| 73 | - $query_args['group_by'] = 'TKT_ID'; |
|
| 74 | - |
|
| 75 | - $query_args['default_where_conditions'] = 'minimum'; |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
| 79 | - */ |
|
| 80 | - $input_fields = []; |
|
| 81 | - if (! empty($this->args['where'])) { |
|
| 82 | - $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
| 83 | - |
|
| 84 | - // Use the proper operator. |
|
| 85 | - if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) { |
|
| 86 | - $input_fields['Datetime.DTT_ID'] = ['in', $input_fields['Datetime.DTT_ID']]; |
|
| 87 | - } |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Determine where we're at in the Graph and adjust the query context appropriately. |
|
| 92 | - */ |
|
| 93 | - if ($this->source instanceof EE_Datetime) { |
|
| 94 | - $where_params['Datetime.DTT_ID'] = $this->source->ID(); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Merge the input_fields with the default query_args |
|
| 99 | - */ |
|
| 100 | - if (! empty($input_fields)) { |
|
| 101 | - $where_params = array_merge($where_params, $input_fields); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID'); |
|
| 105 | - |
|
| 106 | - $where_params = apply_filters( |
|
| 107 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_where_params', |
|
| 108 | - $where_params, |
|
| 109 | - $this->source, |
|
| 110 | - $this->args |
|
| 111 | - ); |
|
| 112 | - |
|
| 113 | - $query_args[] = $where_params; |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Return the $query_args |
|
| 117 | - */ |
|
| 118 | - return apply_filters( |
|
| 119 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_query_args', |
|
| 120 | - $query_args, |
|
| 121 | - $this->source, |
|
| 122 | - $this->args |
|
| 123 | - ); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 129 | - * friendly keys. |
|
| 130 | - * |
|
| 131 | - * @param array $where_args |
|
| 132 | - * @return array |
|
| 133 | - */ |
|
| 134 | - public function sanitizeInputFields(array $where_args) |
|
| 135 | - { |
|
| 136 | - $arg_mapping = [ |
|
| 137 | - 'datetime' => 'Datetime.DTT_ID', |
|
| 138 | - 'datetimeIn' => 'Datetime.DTT_ID', |
|
| 139 | - 'datetimeIdIn' => 'Datetime.DTT_ID', |
|
| 140 | - 'datetimeId' => 'Datetime.DTT_ID', // priority. |
|
| 141 | - ]; |
|
| 142 | - return $this->sanitizeWhereArgsForInputFields( |
|
| 143 | - $where_args, |
|
| 144 | - $arg_mapping, |
|
| 145 | - ['datetime', 'datetimeIn'] |
|
| 146 | - ); |
|
| 147 | - } |
|
| 18 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 19 | + public function get_loader_name() |
|
| 20 | + { |
|
| 21 | + return 'espresso_ticket'; |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @return EEM_Ticket |
|
| 26 | + * @throws EE_Error |
|
| 27 | + * @throws InvalidArgumentException |
|
| 28 | + * @throws InvalidDataTypeException |
|
| 29 | + * @throws InvalidInterfaceException |
|
| 30 | + */ |
|
| 31 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 32 | + public function get_query() |
|
| 33 | + { |
|
| 34 | + return EEM_Ticket::instance(); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Return an array of item IDs from the query |
|
| 40 | + * |
|
| 41 | + * @return array |
|
| 42 | + */ |
|
| 43 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 44 | + public function get_ids() |
|
| 45 | + { |
|
| 46 | + $results = $this->query->get_col($this->query_args); |
|
| 47 | + |
|
| 48 | + return ! empty($results) ? $results : []; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Here, we map the args from the input, then we make sure that we're only querying |
|
| 54 | + * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
| 55 | + * handle batch resolution of the posts. |
|
| 56 | + * |
|
| 57 | + * @return array |
|
| 58 | + * @throws EE_Error |
|
| 59 | + * @throws InvalidArgumentException |
|
| 60 | + * @throws ReflectionException |
|
| 61 | + * @throws InvalidDataTypeException |
|
| 62 | + * @throws InvalidInterfaceException |
|
| 63 | + */ |
|
| 64 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 65 | + public function get_query_args() |
|
| 66 | + { |
|
| 67 | + $where_params = ['TKT_deleted' => ['IN', [true, false]]]; |
|
| 68 | + $query_args = []; |
|
| 69 | + |
|
| 70 | + $query_args['limit'] = $this->getLimit(); |
|
| 71 | + |
|
| 72 | + // Avoid multiple entries by join. |
|
| 73 | + $query_args['group_by'] = 'TKT_ID'; |
|
| 74 | + |
|
| 75 | + $query_args['default_where_conditions'] = 'minimum'; |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
| 79 | + */ |
|
| 80 | + $input_fields = []; |
|
| 81 | + if (! empty($this->args['where'])) { |
|
| 82 | + $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
| 83 | + |
|
| 84 | + // Use the proper operator. |
|
| 85 | + if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) { |
|
| 86 | + $input_fields['Datetime.DTT_ID'] = ['in', $input_fields['Datetime.DTT_ID']]; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Determine where we're at in the Graph and adjust the query context appropriately. |
|
| 92 | + */ |
|
| 93 | + if ($this->source instanceof EE_Datetime) { |
|
| 94 | + $where_params['Datetime.DTT_ID'] = $this->source->ID(); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Merge the input_fields with the default query_args |
|
| 99 | + */ |
|
| 100 | + if (! empty($input_fields)) { |
|
| 101 | + $where_params = array_merge($where_params, $input_fields); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID'); |
|
| 105 | + |
|
| 106 | + $where_params = apply_filters( |
|
| 107 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_where_params', |
|
| 108 | + $where_params, |
|
| 109 | + $this->source, |
|
| 110 | + $this->args |
|
| 111 | + ); |
|
| 112 | + |
|
| 113 | + $query_args[] = $where_params; |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Return the $query_args |
|
| 117 | + */ |
|
| 118 | + return apply_filters( |
|
| 119 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_query_args', |
|
| 120 | + $query_args, |
|
| 121 | + $this->source, |
|
| 122 | + $this->args |
|
| 123 | + ); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 129 | + * friendly keys. |
|
| 130 | + * |
|
| 131 | + * @param array $where_args |
|
| 132 | + * @return array |
|
| 133 | + */ |
|
| 134 | + public function sanitizeInputFields(array $where_args) |
|
| 135 | + { |
|
| 136 | + $arg_mapping = [ |
|
| 137 | + 'datetime' => 'Datetime.DTT_ID', |
|
| 138 | + 'datetimeIn' => 'Datetime.DTT_ID', |
|
| 139 | + 'datetimeIdIn' => 'Datetime.DTT_ID', |
|
| 140 | + 'datetimeId' => 'Datetime.DTT_ID', // priority. |
|
| 141 | + ]; |
|
| 142 | + return $this->sanitizeWhereArgsForInputFields( |
|
| 143 | + $where_args, |
|
| 144 | + $arg_mapping, |
|
| 145 | + ['datetime', 'datetimeIn'] |
|
| 146 | + ); |
|
| 147 | + } |
|
| 148 | 148 | } |
@@ -25,222 +25,222 @@ |
||
| 25 | 25 | class Price extends TypeBase |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Price constructor. |
|
| 30 | - * |
|
| 31 | - * @param EEM_Price $price_model |
|
| 32 | - */ |
|
| 33 | - public function __construct(EEM_Price $price_model) |
|
| 34 | - { |
|
| 35 | - $this->model = $price_model; |
|
| 36 | - $this->setName($this->namespace . 'Price'); |
|
| 37 | - $this->setDescription(__('A price.', 'event_espresso')); |
|
| 38 | - $this->setIsCustomPostType(false); |
|
| 39 | - parent::__construct(); |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * Price constructor. |
|
| 30 | + * |
|
| 31 | + * @param EEM_Price $price_model |
|
| 32 | + */ |
|
| 33 | + public function __construct(EEM_Price $price_model) |
|
| 34 | + { |
|
| 35 | + $this->model = $price_model; |
|
| 36 | + $this->setName($this->namespace . 'Price'); |
|
| 37 | + $this->setDescription(__('A price.', 'event_espresso')); |
|
| 38 | + $this->setIsCustomPostType(false); |
|
| 39 | + parent::__construct(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @return GraphQLFieldInterface[] |
|
| 45 | - * @since $VID:$ |
|
| 46 | - */ |
|
| 47 | - public function getFields() |
|
| 48 | - { |
|
| 49 | - $fields = [ |
|
| 50 | - new GraphQLField( |
|
| 51 | - 'id', |
|
| 52 | - ['non_null' => 'ID'], |
|
| 53 | - null, |
|
| 54 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 55 | - ), |
|
| 56 | - new GraphQLOutputField( |
|
| 57 | - 'dbId', |
|
| 58 | - ['non_null' => 'Int'], |
|
| 59 | - 'ID', |
|
| 60 | - esc_html__('Price ID', 'event_espresso') |
|
| 61 | - ), |
|
| 62 | - new GraphQLField( |
|
| 63 | - 'amount', |
|
| 64 | - 'Float', |
|
| 65 | - 'amount', |
|
| 66 | - esc_html__('Price Amount', 'event_espresso') |
|
| 67 | - ), |
|
| 68 | - new GraphQLOutputField( |
|
| 69 | - 'cacheId', |
|
| 70 | - ['non_null' => 'String'], |
|
| 71 | - null, |
|
| 72 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 73 | - ), |
|
| 74 | - new GraphQLField( |
|
| 75 | - 'description', |
|
| 76 | - 'String', |
|
| 77 | - 'desc', |
|
| 78 | - esc_html__('Price description', 'event_espresso') |
|
| 79 | - ), |
|
| 80 | - new GraphQLOutputField( |
|
| 81 | - 'isBasePrice', |
|
| 82 | - 'Boolean', |
|
| 83 | - 'is_base_price', |
|
| 84 | - esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
| 85 | - ), |
|
| 86 | - new GraphQLField( |
|
| 87 | - 'isDefault', |
|
| 88 | - 'Boolean', |
|
| 89 | - 'is_default', |
|
| 90 | - esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
| 91 | - ), |
|
| 92 | - new GraphQLOutputField( |
|
| 93 | - 'isDiscount', |
|
| 94 | - 'Boolean', |
|
| 95 | - 'is_discount', |
|
| 96 | - esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
| 97 | - ), |
|
| 98 | - new GraphQLOutputField( |
|
| 99 | - 'isPercent', |
|
| 100 | - 'Boolean', |
|
| 101 | - 'is_percent', |
|
| 102 | - esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
| 103 | - ), |
|
| 104 | - new GraphQLOutputField( |
|
| 105 | - 'isTax', |
|
| 106 | - 'Boolean', |
|
| 107 | - 'is_tax', |
|
| 108 | - esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
| 109 | - ), |
|
| 110 | - new GraphQLField( |
|
| 111 | - 'isTrashed', |
|
| 112 | - 'Boolean', |
|
| 113 | - 'deleted', |
|
| 114 | - esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
| 115 | - ), |
|
| 116 | - new GraphQLField( |
|
| 117 | - 'name', |
|
| 118 | - 'String', |
|
| 119 | - 'name', |
|
| 120 | - esc_html__('Price Name', 'event_espresso') |
|
| 121 | - ), |
|
| 122 | - new GraphQLField( |
|
| 123 | - 'order', |
|
| 124 | - 'Int', |
|
| 125 | - 'order', |
|
| 126 | - esc_html__('Order of Application of Price.', 'event_espresso') |
|
| 127 | - ), |
|
| 128 | - new GraphQLField( |
|
| 129 | - 'overrides', |
|
| 130 | - 'Int', |
|
| 131 | - 'overrides', |
|
| 132 | - esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
| 133 | - ), |
|
| 134 | - new GraphQLOutputField( |
|
| 135 | - 'parent', |
|
| 136 | - $this->name(), |
|
| 137 | - null, |
|
| 138 | - esc_html__('The parent price of the current price', 'event_espresso') |
|
| 139 | - ), |
|
| 140 | - new GraphQLInputField( |
|
| 141 | - 'parent', |
|
| 142 | - 'ID', |
|
| 143 | - null, |
|
| 144 | - esc_html__('The parent price ID', 'event_espresso') |
|
| 145 | - ), |
|
| 146 | - new GraphQLOutputField( |
|
| 147 | - 'priceType', |
|
| 148 | - $this->namespace . 'PriceType', |
|
| 149 | - 'type_obj', |
|
| 150 | - esc_html__('The related price type object.', 'event_espresso') |
|
| 151 | - ), |
|
| 152 | - new GraphQLInputField( |
|
| 153 | - 'priceType', |
|
| 154 | - 'ID', |
|
| 155 | - null, |
|
| 156 | - esc_html__('The price type ID', 'event_espresso') |
|
| 157 | - ), |
|
| 158 | - new GraphQLOutputField( |
|
| 159 | - 'wpUser', |
|
| 160 | - 'User', |
|
| 161 | - null, |
|
| 162 | - esc_html__('Price Creator', 'event_espresso') |
|
| 163 | - ), |
|
| 164 | - new GraphQLInputField( |
|
| 165 | - 'wpUser', |
|
| 166 | - 'Int', |
|
| 167 | - null, |
|
| 168 | - esc_html__('Price Creator ID', 'event_espresso') |
|
| 169 | - ), |
|
| 170 | - ]; |
|
| 43 | + /** |
|
| 44 | + * @return GraphQLFieldInterface[] |
|
| 45 | + * @since $VID:$ |
|
| 46 | + */ |
|
| 47 | + public function getFields() |
|
| 48 | + { |
|
| 49 | + $fields = [ |
|
| 50 | + new GraphQLField( |
|
| 51 | + 'id', |
|
| 52 | + ['non_null' => 'ID'], |
|
| 53 | + null, |
|
| 54 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 55 | + ), |
|
| 56 | + new GraphQLOutputField( |
|
| 57 | + 'dbId', |
|
| 58 | + ['non_null' => 'Int'], |
|
| 59 | + 'ID', |
|
| 60 | + esc_html__('Price ID', 'event_espresso') |
|
| 61 | + ), |
|
| 62 | + new GraphQLField( |
|
| 63 | + 'amount', |
|
| 64 | + 'Float', |
|
| 65 | + 'amount', |
|
| 66 | + esc_html__('Price Amount', 'event_espresso') |
|
| 67 | + ), |
|
| 68 | + new GraphQLOutputField( |
|
| 69 | + 'cacheId', |
|
| 70 | + ['non_null' => 'String'], |
|
| 71 | + null, |
|
| 72 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 73 | + ), |
|
| 74 | + new GraphQLField( |
|
| 75 | + 'description', |
|
| 76 | + 'String', |
|
| 77 | + 'desc', |
|
| 78 | + esc_html__('Price description', 'event_espresso') |
|
| 79 | + ), |
|
| 80 | + new GraphQLOutputField( |
|
| 81 | + 'isBasePrice', |
|
| 82 | + 'Boolean', |
|
| 83 | + 'is_base_price', |
|
| 84 | + esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
| 85 | + ), |
|
| 86 | + new GraphQLField( |
|
| 87 | + 'isDefault', |
|
| 88 | + 'Boolean', |
|
| 89 | + 'is_default', |
|
| 90 | + esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
| 91 | + ), |
|
| 92 | + new GraphQLOutputField( |
|
| 93 | + 'isDiscount', |
|
| 94 | + 'Boolean', |
|
| 95 | + 'is_discount', |
|
| 96 | + esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
| 97 | + ), |
|
| 98 | + new GraphQLOutputField( |
|
| 99 | + 'isPercent', |
|
| 100 | + 'Boolean', |
|
| 101 | + 'is_percent', |
|
| 102 | + esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
| 103 | + ), |
|
| 104 | + new GraphQLOutputField( |
|
| 105 | + 'isTax', |
|
| 106 | + 'Boolean', |
|
| 107 | + 'is_tax', |
|
| 108 | + esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
| 109 | + ), |
|
| 110 | + new GraphQLField( |
|
| 111 | + 'isTrashed', |
|
| 112 | + 'Boolean', |
|
| 113 | + 'deleted', |
|
| 114 | + esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
| 115 | + ), |
|
| 116 | + new GraphQLField( |
|
| 117 | + 'name', |
|
| 118 | + 'String', |
|
| 119 | + 'name', |
|
| 120 | + esc_html__('Price Name', 'event_espresso') |
|
| 121 | + ), |
|
| 122 | + new GraphQLField( |
|
| 123 | + 'order', |
|
| 124 | + 'Int', |
|
| 125 | + 'order', |
|
| 126 | + esc_html__('Order of Application of Price.', 'event_espresso') |
|
| 127 | + ), |
|
| 128 | + new GraphQLField( |
|
| 129 | + 'overrides', |
|
| 130 | + 'Int', |
|
| 131 | + 'overrides', |
|
| 132 | + esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
| 133 | + ), |
|
| 134 | + new GraphQLOutputField( |
|
| 135 | + 'parent', |
|
| 136 | + $this->name(), |
|
| 137 | + null, |
|
| 138 | + esc_html__('The parent price of the current price', 'event_espresso') |
|
| 139 | + ), |
|
| 140 | + new GraphQLInputField( |
|
| 141 | + 'parent', |
|
| 142 | + 'ID', |
|
| 143 | + null, |
|
| 144 | + esc_html__('The parent price ID', 'event_espresso') |
|
| 145 | + ), |
|
| 146 | + new GraphQLOutputField( |
|
| 147 | + 'priceType', |
|
| 148 | + $this->namespace . 'PriceType', |
|
| 149 | + 'type_obj', |
|
| 150 | + esc_html__('The related price type object.', 'event_espresso') |
|
| 151 | + ), |
|
| 152 | + new GraphQLInputField( |
|
| 153 | + 'priceType', |
|
| 154 | + 'ID', |
|
| 155 | + null, |
|
| 156 | + esc_html__('The price type ID', 'event_espresso') |
|
| 157 | + ), |
|
| 158 | + new GraphQLOutputField( |
|
| 159 | + 'wpUser', |
|
| 160 | + 'User', |
|
| 161 | + null, |
|
| 162 | + esc_html__('Price Creator', 'event_espresso') |
|
| 163 | + ), |
|
| 164 | + new GraphQLInputField( |
|
| 165 | + 'wpUser', |
|
| 166 | + 'Int', |
|
| 167 | + null, |
|
| 168 | + esc_html__('Price Creator ID', 'event_espresso') |
|
| 169 | + ), |
|
| 170 | + ]; |
|
| 171 | 171 | |
| 172 | - return apply_filters( |
|
| 173 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__price_fields', |
|
| 174 | - $fields, |
|
| 175 | - $this->name, |
|
| 176 | - $this->model |
|
| 177 | - ); |
|
| 178 | - } |
|
| 172 | + return apply_filters( |
|
| 173 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__price_fields', |
|
| 174 | + $fields, |
|
| 175 | + $this->name, |
|
| 176 | + $this->model |
|
| 177 | + ); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * @param array $inputFields The mutation input fields. |
|
| 183 | - * @throws InvalidArgumentException |
|
| 184 | - * @throws ReflectionException |
|
| 185 | - * @since $VID:$ |
|
| 186 | - */ |
|
| 187 | - public function registerMutations(array $inputFields) |
|
| 188 | - { |
|
| 189 | - // Register mutation to update an entity. |
|
| 190 | - register_graphql_mutation( |
|
| 191 | - 'update' . $this->name(), |
|
| 192 | - [ |
|
| 193 | - 'inputFields' => $inputFields, |
|
| 194 | - 'outputFields' => [ |
|
| 195 | - lcfirst($this->name()) => [ |
|
| 196 | - 'type' => $this->name(), |
|
| 197 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 198 | - ], |
|
| 199 | - ], |
|
| 200 | - 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
| 201 | - ] |
|
| 202 | - ); |
|
| 203 | - // Register mutation to delete an entity. |
|
| 204 | - register_graphql_mutation( |
|
| 205 | - 'delete' . $this->name(), |
|
| 206 | - [ |
|
| 207 | - 'inputFields' => [ |
|
| 208 | - 'id' => $inputFields['id'], |
|
| 209 | - 'deletePermanently' => [ |
|
| 210 | - 'type' => 'Boolean', |
|
| 211 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
| 212 | - ], |
|
| 213 | - ], |
|
| 214 | - 'outputFields' => [ |
|
| 215 | - lcfirst($this->name()) => [ |
|
| 216 | - 'type' => $this->name(), |
|
| 217 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
| 218 | - 'resolve' => static function ($payload) { |
|
| 219 | - $deleted = (object) $payload['deleted']; |
|
| 181 | + /** |
|
| 182 | + * @param array $inputFields The mutation input fields. |
|
| 183 | + * @throws InvalidArgumentException |
|
| 184 | + * @throws ReflectionException |
|
| 185 | + * @since $VID:$ |
|
| 186 | + */ |
|
| 187 | + public function registerMutations(array $inputFields) |
|
| 188 | + { |
|
| 189 | + // Register mutation to update an entity. |
|
| 190 | + register_graphql_mutation( |
|
| 191 | + 'update' . $this->name(), |
|
| 192 | + [ |
|
| 193 | + 'inputFields' => $inputFields, |
|
| 194 | + 'outputFields' => [ |
|
| 195 | + lcfirst($this->name()) => [ |
|
| 196 | + 'type' => $this->name(), |
|
| 197 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 198 | + ], |
|
| 199 | + ], |
|
| 200 | + 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
| 201 | + ] |
|
| 202 | + ); |
|
| 203 | + // Register mutation to delete an entity. |
|
| 204 | + register_graphql_mutation( |
|
| 205 | + 'delete' . $this->name(), |
|
| 206 | + [ |
|
| 207 | + 'inputFields' => [ |
|
| 208 | + 'id' => $inputFields['id'], |
|
| 209 | + 'deletePermanently' => [ |
|
| 210 | + 'type' => 'Boolean', |
|
| 211 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
| 212 | + ], |
|
| 213 | + ], |
|
| 214 | + 'outputFields' => [ |
|
| 215 | + lcfirst($this->name()) => [ |
|
| 216 | + 'type' => $this->name(), |
|
| 217 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
| 218 | + 'resolve' => static function ($payload) { |
|
| 219 | + $deleted = (object) $payload['deleted']; |
|
| 220 | 220 | |
| 221 | - return ! empty($deleted) ? $deleted : null; |
|
| 222 | - }, |
|
| 223 | - ], |
|
| 224 | - ], |
|
| 225 | - 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
| 226 | - ] |
|
| 227 | - ); |
|
| 221 | + return ! empty($deleted) ? $deleted : null; |
|
| 222 | + }, |
|
| 223 | + ], |
|
| 224 | + ], |
|
| 225 | + 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
| 226 | + ] |
|
| 227 | + ); |
|
| 228 | 228 | |
| 229 | - // remove primary key from input. |
|
| 230 | - unset($inputFields['id']); |
|
| 231 | - // Register mutation to update an entity. |
|
| 232 | - register_graphql_mutation( |
|
| 233 | - 'create' . $this->name(), |
|
| 234 | - [ |
|
| 235 | - 'inputFields' => $inputFields, |
|
| 236 | - 'outputFields' => [ |
|
| 237 | - lcfirst($this->name()) => [ |
|
| 238 | - 'type' => $this->name(), |
|
| 239 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 240 | - ], |
|
| 241 | - ], |
|
| 242 | - 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
| 243 | - ] |
|
| 244 | - ); |
|
| 245 | - } |
|
| 229 | + // remove primary key from input. |
|
| 230 | + unset($inputFields['id']); |
|
| 231 | + // Register mutation to update an entity. |
|
| 232 | + register_graphql_mutation( |
|
| 233 | + 'create' . $this->name(), |
|
| 234 | + [ |
|
| 235 | + 'inputFields' => $inputFields, |
|
| 236 | + 'outputFields' => [ |
|
| 237 | + lcfirst($this->name()) => [ |
|
| 238 | + 'type' => $this->name(), |
|
| 239 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 240 | + ], |
|
| 241 | + ], |
|
| 242 | + 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
| 243 | + ] |
|
| 244 | + ); |
|
| 245 | + } |
|
| 246 | 246 | } |
@@ -22,113 +22,113 @@ |
||
| 22 | 22 | class PriceType extends TypeBase |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * PriceType constructor. |
|
| 27 | - * |
|
| 28 | - * @param EEM_Price_Type $price_type_model |
|
| 29 | - */ |
|
| 30 | - public function __construct(EEM_Price_Type $price_type_model) |
|
| 31 | - { |
|
| 32 | - $this->model = $price_type_model; |
|
| 33 | - $this->setName($this->namespace. 'PriceType'); |
|
| 34 | - $this->setDescription(__('A price type.', 'event_espresso')); |
|
| 35 | - $this->setIsCustomPostType(false); |
|
| 36 | - parent::__construct(); |
|
| 37 | - } |
|
| 25 | + /** |
|
| 26 | + * PriceType constructor. |
|
| 27 | + * |
|
| 28 | + * @param EEM_Price_Type $price_type_model |
|
| 29 | + */ |
|
| 30 | + public function __construct(EEM_Price_Type $price_type_model) |
|
| 31 | + { |
|
| 32 | + $this->model = $price_type_model; |
|
| 33 | + $this->setName($this->namespace. 'PriceType'); |
|
| 34 | + $this->setDescription(__('A price type.', 'event_espresso')); |
|
| 35 | + $this->setIsCustomPostType(false); |
|
| 36 | + parent::__construct(); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return GraphQLFieldInterface[] |
|
| 42 | - * @since $VID:$ |
|
| 43 | - */ |
|
| 44 | - public function getFields() |
|
| 45 | - { |
|
| 46 | - $fields = [ |
|
| 47 | - new GraphQLField( |
|
| 48 | - 'id', |
|
| 49 | - ['non_null' => 'ID'], |
|
| 50 | - null, |
|
| 51 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 52 | - ), |
|
| 53 | - new GraphQLOutputField( |
|
| 54 | - 'dbId', |
|
| 55 | - ['non_null' => 'Int'], |
|
| 56 | - 'ID', |
|
| 57 | - esc_html__('Price type ID', 'event_espresso') |
|
| 58 | - ), |
|
| 59 | - new GraphQLField( |
|
| 60 | - 'baseType', |
|
| 61 | - $this->namespace . 'PriceBaseTypeEnum', |
|
| 62 | - 'base_type', |
|
| 63 | - esc_html__('Price Base type', 'event_espresso') |
|
| 64 | - ), |
|
| 65 | - new GraphQLOutputField( |
|
| 66 | - 'cacheId', |
|
| 67 | - ['non_null' => 'String'], |
|
| 68 | - null, |
|
| 69 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 70 | - ), |
|
| 71 | - new GraphQLField( |
|
| 72 | - 'isBasePrice', |
|
| 73 | - 'Boolean', |
|
| 74 | - 'is_base_price', |
|
| 75 | - esc_html__('Flag indicating price type is a base price.', 'event_espresso') |
|
| 76 | - ), |
|
| 77 | - new GraphQLField( |
|
| 78 | - 'isTrashed', |
|
| 79 | - 'Boolean', |
|
| 80 | - 'deleted', |
|
| 81 | - esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
| 82 | - ), |
|
| 83 | - new GraphQLOutputField( |
|
| 84 | - 'isDiscount', |
|
| 85 | - 'Boolean', |
|
| 86 | - 'is_discount', |
|
| 87 | - esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
| 88 | - ), |
|
| 89 | - new GraphQLField( |
|
| 90 | - 'isPercent', |
|
| 91 | - 'Boolean', |
|
| 92 | - 'is_percent', |
|
| 93 | - esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
| 94 | - ), |
|
| 95 | - new GraphQLOutputField( |
|
| 96 | - 'isTax', |
|
| 97 | - 'Boolean', |
|
| 98 | - 'is_tax', |
|
| 99 | - esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
| 100 | - ), |
|
| 101 | - new GraphQLField( |
|
| 102 | - 'name', |
|
| 103 | - 'String', |
|
| 104 | - 'name', |
|
| 105 | - esc_html__('Price type Name', 'event_espresso') |
|
| 106 | - ), |
|
| 107 | - new GraphQLField( |
|
| 108 | - 'order', |
|
| 109 | - 'Int', |
|
| 110 | - 'order', |
|
| 111 | - esc_html__('Order in which price should be applied.', 'event_espresso') |
|
| 112 | - ), |
|
| 113 | - new GraphQLOutputField( |
|
| 114 | - 'wpUser', |
|
| 115 | - 'User', |
|
| 116 | - null, |
|
| 117 | - esc_html__('Price Type Creator', 'event_espresso') |
|
| 118 | - ), |
|
| 119 | - new GraphQLInputField( |
|
| 120 | - 'wpUser', |
|
| 121 | - 'Int', |
|
| 122 | - null, |
|
| 123 | - esc_html__('Price Type Creator ID', 'event_espresso') |
|
| 124 | - ), |
|
| 125 | - ]; |
|
| 40 | + /** |
|
| 41 | + * @return GraphQLFieldInterface[] |
|
| 42 | + * @since $VID:$ |
|
| 43 | + */ |
|
| 44 | + public function getFields() |
|
| 45 | + { |
|
| 46 | + $fields = [ |
|
| 47 | + new GraphQLField( |
|
| 48 | + 'id', |
|
| 49 | + ['non_null' => 'ID'], |
|
| 50 | + null, |
|
| 51 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 52 | + ), |
|
| 53 | + new GraphQLOutputField( |
|
| 54 | + 'dbId', |
|
| 55 | + ['non_null' => 'Int'], |
|
| 56 | + 'ID', |
|
| 57 | + esc_html__('Price type ID', 'event_espresso') |
|
| 58 | + ), |
|
| 59 | + new GraphQLField( |
|
| 60 | + 'baseType', |
|
| 61 | + $this->namespace . 'PriceBaseTypeEnum', |
|
| 62 | + 'base_type', |
|
| 63 | + esc_html__('Price Base type', 'event_espresso') |
|
| 64 | + ), |
|
| 65 | + new GraphQLOutputField( |
|
| 66 | + 'cacheId', |
|
| 67 | + ['non_null' => 'String'], |
|
| 68 | + null, |
|
| 69 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 70 | + ), |
|
| 71 | + new GraphQLField( |
|
| 72 | + 'isBasePrice', |
|
| 73 | + 'Boolean', |
|
| 74 | + 'is_base_price', |
|
| 75 | + esc_html__('Flag indicating price type is a base price.', 'event_espresso') |
|
| 76 | + ), |
|
| 77 | + new GraphQLField( |
|
| 78 | + 'isTrashed', |
|
| 79 | + 'Boolean', |
|
| 80 | + 'deleted', |
|
| 81 | + esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
| 82 | + ), |
|
| 83 | + new GraphQLOutputField( |
|
| 84 | + 'isDiscount', |
|
| 85 | + 'Boolean', |
|
| 86 | + 'is_discount', |
|
| 87 | + esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
| 88 | + ), |
|
| 89 | + new GraphQLField( |
|
| 90 | + 'isPercent', |
|
| 91 | + 'Boolean', |
|
| 92 | + 'is_percent', |
|
| 93 | + esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
| 94 | + ), |
|
| 95 | + new GraphQLOutputField( |
|
| 96 | + 'isTax', |
|
| 97 | + 'Boolean', |
|
| 98 | + 'is_tax', |
|
| 99 | + esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
| 100 | + ), |
|
| 101 | + new GraphQLField( |
|
| 102 | + 'name', |
|
| 103 | + 'String', |
|
| 104 | + 'name', |
|
| 105 | + esc_html__('Price type Name', 'event_espresso') |
|
| 106 | + ), |
|
| 107 | + new GraphQLField( |
|
| 108 | + 'order', |
|
| 109 | + 'Int', |
|
| 110 | + 'order', |
|
| 111 | + esc_html__('Order in which price should be applied.', 'event_espresso') |
|
| 112 | + ), |
|
| 113 | + new GraphQLOutputField( |
|
| 114 | + 'wpUser', |
|
| 115 | + 'User', |
|
| 116 | + null, |
|
| 117 | + esc_html__('Price Type Creator', 'event_espresso') |
|
| 118 | + ), |
|
| 119 | + new GraphQLInputField( |
|
| 120 | + 'wpUser', |
|
| 121 | + 'Int', |
|
| 122 | + null, |
|
| 123 | + esc_html__('Price Type Creator ID', 'event_espresso') |
|
| 124 | + ), |
|
| 125 | + ]; |
|
| 126 | 126 | |
| 127 | - return apply_filters( |
|
| 128 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__priceType_fields', |
|
| 129 | - $fields, |
|
| 130 | - $this->name, |
|
| 131 | - $this->model |
|
| 132 | - ); |
|
| 133 | - } |
|
| 127 | + return apply_filters( |
|
| 128 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__priceType_fields', |
|
| 129 | + $fields, |
|
| 130 | + $this->name, |
|
| 131 | + $this->model |
|
| 132 | + ); |
|
| 133 | + } |
|
| 134 | 134 | } |
@@ -21,209 +21,209 @@ |
||
| 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 | - * @since $VID:$ |
|
| 41 | - */ |
|
| 42 | - public function getFields() |
|
| 43 | - { |
|
| 44 | - $fields = [ |
|
| 45 | - new GraphQLOutputField( |
|
| 46 | - 'dbId', |
|
| 47 | - ['non_null' => 'Int'], |
|
| 48 | - 'ID', |
|
| 49 | - esc_html__('The event ID.', 'event_espresso') |
|
| 50 | - ), |
|
| 51 | - new GraphQLOutputField( |
|
| 52 | - 'cacheId', |
|
| 53 | - ['non_null' => 'String'], |
|
| 54 | - null, |
|
| 55 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 56 | - ), |
|
| 57 | - new GraphQLField( |
|
| 58 | - 'name', |
|
| 59 | - 'String', |
|
| 60 | - 'name', |
|
| 61 | - esc_html__('Event Name', 'event_espresso') |
|
| 62 | - ), |
|
| 63 | - new GraphQLField( |
|
| 64 | - 'description', |
|
| 65 | - 'String', |
|
| 66 | - 'description', |
|
| 67 | - esc_html__('Event Description', 'event_espresso') |
|
| 68 | - ), |
|
| 69 | - new GraphQLField( |
|
| 70 | - 'shortDescription', |
|
| 71 | - 'String', |
|
| 72 | - 'short_description', |
|
| 73 | - esc_html__('Event Short Description', 'event_espresso') |
|
| 74 | - ), |
|
| 75 | - new GraphQLField( |
|
| 76 | - 'created', |
|
| 77 | - 'String', |
|
| 78 | - 'created', |
|
| 79 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
| 80 | - ), |
|
| 81 | - new GraphQLOutputField( |
|
| 82 | - 'wpUser', |
|
| 83 | - 'User', |
|
| 84 | - null, |
|
| 85 | - esc_html__('Event Creator', 'event_espresso') |
|
| 86 | - ), |
|
| 87 | - new GraphQLInputField( |
|
| 88 | - 'wpUser', |
|
| 89 | - 'Int', |
|
| 90 | - null, |
|
| 91 | - esc_html__('Event Creator ID', 'event_espresso') |
|
| 92 | - ), |
|
| 93 | - new GraphQLField( |
|
| 94 | - 'order', |
|
| 95 | - 'Int', |
|
| 96 | - 'order', |
|
| 97 | - esc_html__('Event Menu Order', 'event_espresso') |
|
| 98 | - ), |
|
| 99 | - new GraphQLField( |
|
| 100 | - 'displayDesc', |
|
| 101 | - 'Boolean', |
|
| 102 | - 'display_description', |
|
| 103 | - esc_html__('Display Description Flag', 'event_espresso') |
|
| 104 | - ), |
|
| 105 | - new GraphQLField( |
|
| 106 | - 'displayTicketSelector', |
|
| 107 | - 'Boolean', |
|
| 108 | - 'display_ticket_selector', |
|
| 109 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
| 110 | - ), |
|
| 111 | - new GraphQLField( |
|
| 112 | - 'visibleOn', |
|
| 113 | - 'String', |
|
| 114 | - 'visible_on', |
|
| 115 | - esc_html__('Event Visible Date', 'event_espresso') |
|
| 116 | - ), |
|
| 117 | - new GraphQLField( |
|
| 118 | - 'additionalLimit', |
|
| 119 | - 'Int', |
|
| 120 | - 'additional_limit', |
|
| 121 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
| 122 | - ), |
|
| 123 | - new GraphQLField( |
|
| 124 | - 'phone', |
|
| 125 | - 'String', |
|
| 126 | - 'phone', |
|
| 127 | - esc_html__('Event Phone Number', 'event_espresso') |
|
| 128 | - ), |
|
| 129 | - new GraphQLField( |
|
| 130 | - 'memberOnly', |
|
| 131 | - 'Boolean', |
|
| 132 | - 'member_only', |
|
| 133 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
| 134 | - ), |
|
| 135 | - new GraphQLField( |
|
| 136 | - 'allowOverflow', |
|
| 137 | - 'Boolean', |
|
| 138 | - 'allow_overflow', |
|
| 139 | - esc_html__('Allow Overflow on Event', 'event_espresso') |
|
| 140 | - ), |
|
| 141 | - new GraphQLField( |
|
| 142 | - 'timezoneString', |
|
| 143 | - 'String', |
|
| 144 | - 'timezone_string', |
|
| 145 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
| 146 | - ), |
|
| 147 | - new GraphQLField( |
|
| 148 | - 'externalUrl', |
|
| 149 | - 'String', |
|
| 150 | - 'external_url', |
|
| 151 | - esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
| 152 | - ), |
|
| 153 | - new GraphQLField( |
|
| 154 | - 'donations', |
|
| 155 | - 'Boolean', |
|
| 156 | - 'donations', |
|
| 157 | - esc_html__('Accept Donations?', 'event_espresso') |
|
| 158 | - ), |
|
| 159 | - new GraphQLField( |
|
| 160 | - 'isSoldOut', |
|
| 161 | - 'Boolean', |
|
| 162 | - 'is_sold_out', |
|
| 163 | - esc_html__( |
|
| 164 | - 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 165 | - 'event_espresso' |
|
| 166 | - ) |
|
| 167 | - ), |
|
| 168 | - new GraphQLField( |
|
| 169 | - 'isPostponed', |
|
| 170 | - 'Boolean', |
|
| 171 | - 'is_postponed', |
|
| 172 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
| 173 | - ), |
|
| 174 | - new GraphQLField( |
|
| 175 | - 'isCancelled', |
|
| 176 | - 'Boolean', |
|
| 177 | - 'is_cancelled', |
|
| 178 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
| 179 | - ), |
|
| 180 | - new GraphQLOutputField( |
|
| 181 | - 'isUpcoming', |
|
| 182 | - 'Boolean', |
|
| 183 | - 'is_upcoming', |
|
| 184 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
| 185 | - ), |
|
| 186 | - new GraphQLOutputField( |
|
| 187 | - 'isActive', |
|
| 188 | - 'Boolean', |
|
| 189 | - 'is_active', |
|
| 190 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
| 191 | - ), |
|
| 192 | - new GraphQLOutputField( |
|
| 193 | - 'isInactive', |
|
| 194 | - 'Boolean', |
|
| 195 | - 'is_inactive', |
|
| 196 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
| 197 | - ), |
|
| 198 | - new GraphQLOutputField( |
|
| 199 | - 'isExpired', |
|
| 200 | - 'Boolean', |
|
| 201 | - 'is_expired', |
|
| 202 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
| 203 | - ), |
|
| 204 | - ]; |
|
| 38 | + /** |
|
| 39 | + * @return GraphQLFieldInterface[] |
|
| 40 | + * @since $VID:$ |
|
| 41 | + */ |
|
| 42 | + public function getFields() |
|
| 43 | + { |
|
| 44 | + $fields = [ |
|
| 45 | + new GraphQLOutputField( |
|
| 46 | + 'dbId', |
|
| 47 | + ['non_null' => 'Int'], |
|
| 48 | + 'ID', |
|
| 49 | + esc_html__('The event ID.', 'event_espresso') |
|
| 50 | + ), |
|
| 51 | + new GraphQLOutputField( |
|
| 52 | + 'cacheId', |
|
| 53 | + ['non_null' => 'String'], |
|
| 54 | + null, |
|
| 55 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 56 | + ), |
|
| 57 | + new GraphQLField( |
|
| 58 | + 'name', |
|
| 59 | + 'String', |
|
| 60 | + 'name', |
|
| 61 | + esc_html__('Event Name', 'event_espresso') |
|
| 62 | + ), |
|
| 63 | + new GraphQLField( |
|
| 64 | + 'description', |
|
| 65 | + 'String', |
|
| 66 | + 'description', |
|
| 67 | + esc_html__('Event Description', 'event_espresso') |
|
| 68 | + ), |
|
| 69 | + new GraphQLField( |
|
| 70 | + 'shortDescription', |
|
| 71 | + 'String', |
|
| 72 | + 'short_description', |
|
| 73 | + esc_html__('Event Short Description', 'event_espresso') |
|
| 74 | + ), |
|
| 75 | + new GraphQLField( |
|
| 76 | + 'created', |
|
| 77 | + 'String', |
|
| 78 | + 'created', |
|
| 79 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
| 80 | + ), |
|
| 81 | + new GraphQLOutputField( |
|
| 82 | + 'wpUser', |
|
| 83 | + 'User', |
|
| 84 | + null, |
|
| 85 | + esc_html__('Event Creator', 'event_espresso') |
|
| 86 | + ), |
|
| 87 | + new GraphQLInputField( |
|
| 88 | + 'wpUser', |
|
| 89 | + 'Int', |
|
| 90 | + null, |
|
| 91 | + esc_html__('Event Creator ID', 'event_espresso') |
|
| 92 | + ), |
|
| 93 | + new GraphQLField( |
|
| 94 | + 'order', |
|
| 95 | + 'Int', |
|
| 96 | + 'order', |
|
| 97 | + esc_html__('Event Menu Order', 'event_espresso') |
|
| 98 | + ), |
|
| 99 | + new GraphQLField( |
|
| 100 | + 'displayDesc', |
|
| 101 | + 'Boolean', |
|
| 102 | + 'display_description', |
|
| 103 | + esc_html__('Display Description Flag', 'event_espresso') |
|
| 104 | + ), |
|
| 105 | + new GraphQLField( |
|
| 106 | + 'displayTicketSelector', |
|
| 107 | + 'Boolean', |
|
| 108 | + 'display_ticket_selector', |
|
| 109 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
| 110 | + ), |
|
| 111 | + new GraphQLField( |
|
| 112 | + 'visibleOn', |
|
| 113 | + 'String', |
|
| 114 | + 'visible_on', |
|
| 115 | + esc_html__('Event Visible Date', 'event_espresso') |
|
| 116 | + ), |
|
| 117 | + new GraphQLField( |
|
| 118 | + 'additionalLimit', |
|
| 119 | + 'Int', |
|
| 120 | + 'additional_limit', |
|
| 121 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
| 122 | + ), |
|
| 123 | + new GraphQLField( |
|
| 124 | + 'phone', |
|
| 125 | + 'String', |
|
| 126 | + 'phone', |
|
| 127 | + esc_html__('Event Phone Number', 'event_espresso') |
|
| 128 | + ), |
|
| 129 | + new GraphQLField( |
|
| 130 | + 'memberOnly', |
|
| 131 | + 'Boolean', |
|
| 132 | + 'member_only', |
|
| 133 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
| 134 | + ), |
|
| 135 | + new GraphQLField( |
|
| 136 | + 'allowOverflow', |
|
| 137 | + 'Boolean', |
|
| 138 | + 'allow_overflow', |
|
| 139 | + esc_html__('Allow Overflow on Event', 'event_espresso') |
|
| 140 | + ), |
|
| 141 | + new GraphQLField( |
|
| 142 | + 'timezoneString', |
|
| 143 | + 'String', |
|
| 144 | + 'timezone_string', |
|
| 145 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
| 146 | + ), |
|
| 147 | + new GraphQLField( |
|
| 148 | + 'externalUrl', |
|
| 149 | + 'String', |
|
| 150 | + 'external_url', |
|
| 151 | + esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
| 152 | + ), |
|
| 153 | + new GraphQLField( |
|
| 154 | + 'donations', |
|
| 155 | + 'Boolean', |
|
| 156 | + 'donations', |
|
| 157 | + esc_html__('Accept Donations?', 'event_espresso') |
|
| 158 | + ), |
|
| 159 | + new GraphQLField( |
|
| 160 | + 'isSoldOut', |
|
| 161 | + 'Boolean', |
|
| 162 | + 'is_sold_out', |
|
| 163 | + esc_html__( |
|
| 164 | + 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 165 | + 'event_espresso' |
|
| 166 | + ) |
|
| 167 | + ), |
|
| 168 | + new GraphQLField( |
|
| 169 | + 'isPostponed', |
|
| 170 | + 'Boolean', |
|
| 171 | + 'is_postponed', |
|
| 172 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
| 173 | + ), |
|
| 174 | + new GraphQLField( |
|
| 175 | + 'isCancelled', |
|
| 176 | + 'Boolean', |
|
| 177 | + 'is_cancelled', |
|
| 178 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
| 179 | + ), |
|
| 180 | + new GraphQLOutputField( |
|
| 181 | + 'isUpcoming', |
|
| 182 | + 'Boolean', |
|
| 183 | + 'is_upcoming', |
|
| 184 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
| 185 | + ), |
|
| 186 | + new GraphQLOutputField( |
|
| 187 | + 'isActive', |
|
| 188 | + 'Boolean', |
|
| 189 | + 'is_active', |
|
| 190 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
| 191 | + ), |
|
| 192 | + new GraphQLOutputField( |
|
| 193 | + 'isInactive', |
|
| 194 | + 'Boolean', |
|
| 195 | + 'is_inactive', |
|
| 196 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
| 197 | + ), |
|
| 198 | + new GraphQLOutputField( |
|
| 199 | + 'isExpired', |
|
| 200 | + 'Boolean', |
|
| 201 | + 'is_expired', |
|
| 202 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
| 203 | + ), |
|
| 204 | + ]; |
|
| 205 | 205 | |
| 206 | - return apply_filters( |
|
| 207 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
| 208 | - $fields, |
|
| 209 | - $this->name, |
|
| 210 | - $this->model |
|
| 211 | - ); |
|
| 212 | - } |
|
| 206 | + return apply_filters( |
|
| 207 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
| 208 | + $fields, |
|
| 209 | + $this->name, |
|
| 210 | + $this->model |
|
| 211 | + ); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Extends the existing WP GraphQL mutations. |
|
| 217 | - * |
|
| 218 | - * @since $VID:$ |
|
| 219 | - */ |
|
| 220 | - public function extendMutations() |
|
| 221 | - { |
|
| 222 | - add_action( |
|
| 223 | - 'graphql_post_object_mutation_update_additional_data', |
|
| 224 | - EventUpdate::mutateFields($this->model, $this), |
|
| 225 | - 10, |
|
| 226 | - 6 |
|
| 227 | - ); |
|
| 228 | - } |
|
| 215 | + /** |
|
| 216 | + * Extends the existing WP GraphQL mutations. |
|
| 217 | + * |
|
| 218 | + * @since $VID:$ |
|
| 219 | + */ |
|
| 220 | + public function extendMutations() |
|
| 221 | + { |
|
| 222 | + add_action( |
|
| 223 | + 'graphql_post_object_mutation_update_additional_data', |
|
| 224 | + EventUpdate::mutateFields($this->model, $this), |
|
| 225 | + 10, |
|
| 226 | + 6 |
|
| 227 | + ); |
|
| 228 | + } |
|
| 229 | 229 | } |
@@ -21,201 +21,201 @@ |
||
| 21 | 21 | class Venue extends TypeBase |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Venue constructor. |
|
| 26 | - * |
|
| 27 | - * @param EEM_Venue $venue_model |
|
| 28 | - */ |
|
| 29 | - public function __construct(EEM_Venue $venue_model) |
|
| 30 | - { |
|
| 31 | - $this->model = $venue_model; |
|
| 32 | - $this->setName($this->namespace . 'Venue'); |
|
| 33 | - $this->setIsCustomPostType(true); |
|
| 34 | - parent::__construct(); |
|
| 35 | - } |
|
| 24 | + /** |
|
| 25 | + * Venue constructor. |
|
| 26 | + * |
|
| 27 | + * @param EEM_Venue $venue_model |
|
| 28 | + */ |
|
| 29 | + public function __construct(EEM_Venue $venue_model) |
|
| 30 | + { |
|
| 31 | + $this->model = $venue_model; |
|
| 32 | + $this->setName($this->namespace . 'Venue'); |
|
| 33 | + $this->setIsCustomPostType(true); |
|
| 34 | + parent::__construct(); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return GraphQLFieldInterface[] |
|
| 40 | - * @since $VID:$ |
|
| 41 | - */ |
|
| 42 | - public function getFields() |
|
| 43 | - { |
|
| 44 | - $fields = [ |
|
| 45 | - new GraphQLOutputField( |
|
| 46 | - 'dbId', |
|
| 47 | - ['non_null' => 'Int'], |
|
| 48 | - 'ID', |
|
| 49 | - esc_html__('The venue ID.', 'event_espresso') |
|
| 50 | - ), |
|
| 51 | - new GraphQLOutputField( |
|
| 52 | - 'cacheId', |
|
| 53 | - ['non_null' => 'String'], |
|
| 54 | - null, |
|
| 55 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 56 | - ), |
|
| 57 | - new GraphQLField( |
|
| 58 | - 'name', |
|
| 59 | - 'String', |
|
| 60 | - 'name', |
|
| 61 | - esc_html__('Venue Name', 'event_espresso') |
|
| 62 | - ), |
|
| 63 | - new GraphQLField( |
|
| 64 | - 'description', |
|
| 65 | - 'String', |
|
| 66 | - 'description', |
|
| 67 | - esc_html__('Venue Description', 'event_espresso') |
|
| 68 | - ), |
|
| 69 | - new GraphQLField( |
|
| 70 | - 'shortDescription', |
|
| 71 | - 'String', |
|
| 72 | - 'excerpt', |
|
| 73 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
| 74 | - ), |
|
| 75 | - new GraphQLField( |
|
| 76 | - 'identifier', |
|
| 77 | - 'String', |
|
| 78 | - 'identifier', |
|
| 79 | - esc_html__('Venue Identifier', 'event_espresso') |
|
| 80 | - ), |
|
| 81 | - new GraphQLField( |
|
| 82 | - 'created', |
|
| 83 | - 'String', |
|
| 84 | - 'created', |
|
| 85 | - esc_html__('Date Venue Created', 'event_espresso') |
|
| 86 | - ), |
|
| 87 | - new GraphQLField( |
|
| 88 | - 'order', |
|
| 89 | - 'Int', |
|
| 90 | - 'order', |
|
| 91 | - esc_html__('Venue order', 'event_espresso') |
|
| 92 | - ), |
|
| 93 | - new GraphQLOutputField( |
|
| 94 | - 'wpUser', |
|
| 95 | - 'User', |
|
| 96 | - null, |
|
| 97 | - esc_html__('Venue Creator', 'event_espresso') |
|
| 98 | - ), |
|
| 99 | - new GraphQLInputField( |
|
| 100 | - 'wpUser', |
|
| 101 | - 'Int', |
|
| 102 | - null, |
|
| 103 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
| 104 | - ), |
|
| 105 | - new GraphQLField( |
|
| 106 | - 'address', |
|
| 107 | - 'String', |
|
| 108 | - 'address', |
|
| 109 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
| 110 | - ), |
|
| 111 | - new GraphQLField( |
|
| 112 | - 'address2', |
|
| 113 | - 'String', |
|
| 114 | - 'address2', |
|
| 115 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
| 116 | - ), |
|
| 117 | - new GraphQLField( |
|
| 118 | - 'city', |
|
| 119 | - 'String', |
|
| 120 | - 'city', |
|
| 121 | - esc_html__('Venue City', 'event_espresso') |
|
| 122 | - ), |
|
| 123 | - new GraphQLOutputField( |
|
| 124 | - 'state', |
|
| 125 | - $this->namespace . 'State', |
|
| 126 | - null, |
|
| 127 | - esc_html__('Venue state', 'event_espresso') |
|
| 128 | - ), |
|
| 129 | - new GraphQLInputField( |
|
| 130 | - 'state', |
|
| 131 | - 'Int', |
|
| 132 | - null, |
|
| 133 | - esc_html__('State ID', 'event_espresso') |
|
| 134 | - ), |
|
| 135 | - new GraphQLOutputField( |
|
| 136 | - 'country', |
|
| 137 | - $this->namespace . 'Country', |
|
| 138 | - null, |
|
| 139 | - esc_html__('Venue country', 'event_espresso') |
|
| 140 | - ), |
|
| 141 | - new GraphQLInputField( |
|
| 142 | - 'country', |
|
| 143 | - 'String', |
|
| 144 | - null, |
|
| 145 | - esc_html__('Country ISO Code', 'event_espresso') |
|
| 146 | - ), |
|
| 147 | - new GraphQLField( |
|
| 148 | - 'zip', |
|
| 149 | - 'String', |
|
| 150 | - 'zip', |
|
| 151 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
| 152 | - ), |
|
| 153 | - new GraphQLField( |
|
| 154 | - 'capacity', |
|
| 155 | - 'Int', |
|
| 156 | - 'capacity', |
|
| 157 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
| 158 | - [$this, 'parseInfiniteValue'] |
|
| 159 | - ), |
|
| 160 | - new GraphQLField( |
|
| 161 | - 'phone', |
|
| 162 | - 'String', |
|
| 163 | - 'phone', |
|
| 164 | - esc_html__('Venue Phone', 'event_espresso') |
|
| 165 | - ), |
|
| 166 | - new GraphQLField( |
|
| 167 | - 'virtualPhone', |
|
| 168 | - 'String', |
|
| 169 | - 'virtual_phone', |
|
| 170 | - esc_html__('Call in Number', 'event_espresso') |
|
| 171 | - ), |
|
| 172 | - new GraphQLField( |
|
| 173 | - 'url', |
|
| 174 | - 'String', |
|
| 175 | - 'venue_url', |
|
| 176 | - esc_html__('Venue Website', 'event_espresso') |
|
| 177 | - ), |
|
| 178 | - new GraphQLField( |
|
| 179 | - 'virtualUrl', |
|
| 180 | - 'String', |
|
| 181 | - 'virtual_url', |
|
| 182 | - esc_html__('Virtual URL', 'event_espresso') |
|
| 183 | - ), |
|
| 184 | - new GraphQLField( |
|
| 185 | - 'googleMapLink', |
|
| 186 | - 'String', |
|
| 187 | - 'google_map_link', |
|
| 188 | - esc_html__('Google Map Link', 'event_espresso') |
|
| 189 | - ), |
|
| 190 | - new GraphQLField( |
|
| 191 | - 'enableForGmap', |
|
| 192 | - 'String', |
|
| 193 | - 'enable_for_gmap', |
|
| 194 | - esc_html__('Show Google Map?', 'event_espresso') |
|
| 195 | - ), |
|
| 196 | - ]; |
|
| 38 | + /** |
|
| 39 | + * @return GraphQLFieldInterface[] |
|
| 40 | + * @since $VID:$ |
|
| 41 | + */ |
|
| 42 | + public function getFields() |
|
| 43 | + { |
|
| 44 | + $fields = [ |
|
| 45 | + new GraphQLOutputField( |
|
| 46 | + 'dbId', |
|
| 47 | + ['non_null' => 'Int'], |
|
| 48 | + 'ID', |
|
| 49 | + esc_html__('The venue ID.', 'event_espresso') |
|
| 50 | + ), |
|
| 51 | + new GraphQLOutputField( |
|
| 52 | + 'cacheId', |
|
| 53 | + ['non_null' => 'String'], |
|
| 54 | + null, |
|
| 55 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 56 | + ), |
|
| 57 | + new GraphQLField( |
|
| 58 | + 'name', |
|
| 59 | + 'String', |
|
| 60 | + 'name', |
|
| 61 | + esc_html__('Venue Name', 'event_espresso') |
|
| 62 | + ), |
|
| 63 | + new GraphQLField( |
|
| 64 | + 'description', |
|
| 65 | + 'String', |
|
| 66 | + 'description', |
|
| 67 | + esc_html__('Venue Description', 'event_espresso') |
|
| 68 | + ), |
|
| 69 | + new GraphQLField( |
|
| 70 | + 'shortDescription', |
|
| 71 | + 'String', |
|
| 72 | + 'excerpt', |
|
| 73 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
| 74 | + ), |
|
| 75 | + new GraphQLField( |
|
| 76 | + 'identifier', |
|
| 77 | + 'String', |
|
| 78 | + 'identifier', |
|
| 79 | + esc_html__('Venue Identifier', 'event_espresso') |
|
| 80 | + ), |
|
| 81 | + new GraphQLField( |
|
| 82 | + 'created', |
|
| 83 | + 'String', |
|
| 84 | + 'created', |
|
| 85 | + esc_html__('Date Venue Created', 'event_espresso') |
|
| 86 | + ), |
|
| 87 | + new GraphQLField( |
|
| 88 | + 'order', |
|
| 89 | + 'Int', |
|
| 90 | + 'order', |
|
| 91 | + esc_html__('Venue order', 'event_espresso') |
|
| 92 | + ), |
|
| 93 | + new GraphQLOutputField( |
|
| 94 | + 'wpUser', |
|
| 95 | + 'User', |
|
| 96 | + null, |
|
| 97 | + esc_html__('Venue Creator', 'event_espresso') |
|
| 98 | + ), |
|
| 99 | + new GraphQLInputField( |
|
| 100 | + 'wpUser', |
|
| 101 | + 'Int', |
|
| 102 | + null, |
|
| 103 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
| 104 | + ), |
|
| 105 | + new GraphQLField( |
|
| 106 | + 'address', |
|
| 107 | + 'String', |
|
| 108 | + 'address', |
|
| 109 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
| 110 | + ), |
|
| 111 | + new GraphQLField( |
|
| 112 | + 'address2', |
|
| 113 | + 'String', |
|
| 114 | + 'address2', |
|
| 115 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
| 116 | + ), |
|
| 117 | + new GraphQLField( |
|
| 118 | + 'city', |
|
| 119 | + 'String', |
|
| 120 | + 'city', |
|
| 121 | + esc_html__('Venue City', 'event_espresso') |
|
| 122 | + ), |
|
| 123 | + new GraphQLOutputField( |
|
| 124 | + 'state', |
|
| 125 | + $this->namespace . 'State', |
|
| 126 | + null, |
|
| 127 | + esc_html__('Venue state', 'event_espresso') |
|
| 128 | + ), |
|
| 129 | + new GraphQLInputField( |
|
| 130 | + 'state', |
|
| 131 | + 'Int', |
|
| 132 | + null, |
|
| 133 | + esc_html__('State ID', 'event_espresso') |
|
| 134 | + ), |
|
| 135 | + new GraphQLOutputField( |
|
| 136 | + 'country', |
|
| 137 | + $this->namespace . 'Country', |
|
| 138 | + null, |
|
| 139 | + esc_html__('Venue country', 'event_espresso') |
|
| 140 | + ), |
|
| 141 | + new GraphQLInputField( |
|
| 142 | + 'country', |
|
| 143 | + 'String', |
|
| 144 | + null, |
|
| 145 | + esc_html__('Country ISO Code', 'event_espresso') |
|
| 146 | + ), |
|
| 147 | + new GraphQLField( |
|
| 148 | + 'zip', |
|
| 149 | + 'String', |
|
| 150 | + 'zip', |
|
| 151 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
| 152 | + ), |
|
| 153 | + new GraphQLField( |
|
| 154 | + 'capacity', |
|
| 155 | + 'Int', |
|
| 156 | + 'capacity', |
|
| 157 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
| 158 | + [$this, 'parseInfiniteValue'] |
|
| 159 | + ), |
|
| 160 | + new GraphQLField( |
|
| 161 | + 'phone', |
|
| 162 | + 'String', |
|
| 163 | + 'phone', |
|
| 164 | + esc_html__('Venue Phone', 'event_espresso') |
|
| 165 | + ), |
|
| 166 | + new GraphQLField( |
|
| 167 | + 'virtualPhone', |
|
| 168 | + 'String', |
|
| 169 | + 'virtual_phone', |
|
| 170 | + esc_html__('Call in Number', 'event_espresso') |
|
| 171 | + ), |
|
| 172 | + new GraphQLField( |
|
| 173 | + 'url', |
|
| 174 | + 'String', |
|
| 175 | + 'venue_url', |
|
| 176 | + esc_html__('Venue Website', 'event_espresso') |
|
| 177 | + ), |
|
| 178 | + new GraphQLField( |
|
| 179 | + 'virtualUrl', |
|
| 180 | + 'String', |
|
| 181 | + 'virtual_url', |
|
| 182 | + esc_html__('Virtual URL', 'event_espresso') |
|
| 183 | + ), |
|
| 184 | + new GraphQLField( |
|
| 185 | + 'googleMapLink', |
|
| 186 | + 'String', |
|
| 187 | + 'google_map_link', |
|
| 188 | + esc_html__('Google Map Link', 'event_espresso') |
|
| 189 | + ), |
|
| 190 | + new GraphQLField( |
|
| 191 | + 'enableForGmap', |
|
| 192 | + 'String', |
|
| 193 | + 'enable_for_gmap', |
|
| 194 | + esc_html__('Show Google Map?', 'event_espresso') |
|
| 195 | + ), |
|
| 196 | + ]; |
|
| 197 | 197 | |
| 198 | - return apply_filters( |
|
| 199 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
| 200 | - $fields, |
|
| 201 | - $this->name, |
|
| 202 | - $this->model |
|
| 203 | - ); |
|
| 204 | - } |
|
| 198 | + return apply_filters( |
|
| 199 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
| 200 | + $fields, |
|
| 201 | + $this->name, |
|
| 202 | + $this->model |
|
| 203 | + ); |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * Extends the existing WP GraphQL mutations. |
|
| 209 | - * |
|
| 210 | - * @since $VID:$ |
|
| 211 | - */ |
|
| 212 | - public function extendMutations() |
|
| 213 | - { |
|
| 214 | - add_action( |
|
| 215 | - 'graphql_post_object_mutation_update_additional_data', |
|
| 216 | - VenueUpdate::mutateFields($this->model, $this), |
|
| 217 | - 10, |
|
| 218 | - 6 |
|
| 219 | - ); |
|
| 220 | - } |
|
| 207 | + /** |
|
| 208 | + * Extends the existing WP GraphQL mutations. |
|
| 209 | + * |
|
| 210 | + * @since $VID:$ |
|
| 211 | + */ |
|
| 212 | + public function extendMutations() |
|
| 213 | + { |
|
| 214 | + add_action( |
|
| 215 | + 'graphql_post_object_mutation_update_additional_data', |
|
| 216 | + VenueUpdate::mutateFields($this->model, $this), |
|
| 217 | + 10, |
|
| 218 | + 6 |
|
| 219 | + ); |
|
| 220 | + } |
|
| 221 | 221 | } |
@@ -20,84 +20,84 @@ |
||
| 20 | 20 | class State extends TypeBase |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * State constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_State $state_model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_State $state_model) |
|
| 29 | - { |
|
| 30 | - $this->model = $state_model; |
|
| 31 | - $this->setName($this->namespace . 'State'); |
|
| 32 | - $this->setDescription(__('A state', 'event_espresso')); |
|
| 33 | - $this->setIsCustomPostType(false); |
|
| 23 | + /** |
|
| 24 | + * State constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_State $state_model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_State $state_model) |
|
| 29 | + { |
|
| 30 | + $this->model = $state_model; |
|
| 31 | + $this->setName($this->namespace . 'State'); |
|
| 32 | + $this->setDescription(__('A state', 'event_espresso')); |
|
| 33 | + $this->setIsCustomPostType(false); |
|
| 34 | 34 | |
| 35 | - parent::__construct(); |
|
| 36 | - } |
|
| 35 | + parent::__construct(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @return GraphQLFieldInterface[] |
|
| 41 | - * @since $VID:$ |
|
| 42 | - */ |
|
| 43 | - public function getFields() |
|
| 44 | - { |
|
| 45 | - $fields = [ |
|
| 46 | - new GraphQLField( |
|
| 47 | - 'id', |
|
| 48 | - ['non_null' => 'ID'], |
|
| 49 | - null, |
|
| 50 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 51 | - ), |
|
| 52 | - new GraphQLOutputField( |
|
| 53 | - 'dbId', |
|
| 54 | - ['non_null' => 'Int'], |
|
| 55 | - 'ID', |
|
| 56 | - esc_html__('State ID', 'event_espresso') |
|
| 57 | - ), |
|
| 58 | - new GraphQLField( |
|
| 59 | - 'abbreviation', |
|
| 60 | - 'String', |
|
| 61 | - 'abbrev', |
|
| 62 | - esc_html__('State Abbreviation', 'event_espresso') |
|
| 63 | - ), |
|
| 64 | - new GraphQLOutputField( |
|
| 65 | - 'cacheId', |
|
| 66 | - ['non_null' => 'String'], |
|
| 67 | - null, |
|
| 68 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 69 | - ), |
|
| 70 | - new GraphQLField( |
|
| 71 | - 'name', |
|
| 72 | - 'String', |
|
| 73 | - 'name', |
|
| 74 | - esc_html__('State Name', 'event_espresso') |
|
| 75 | - ), |
|
| 76 | - new GraphQLField( |
|
| 77 | - 'isActive', |
|
| 78 | - 'Boolean', |
|
| 79 | - 'active', |
|
| 80 | - esc_html__('State Active Flag', 'event_espresso') |
|
| 81 | - ), |
|
| 82 | - new GraphQLOutputField( |
|
| 83 | - 'country', |
|
| 84 | - $this->namespace . 'Country', |
|
| 85 | - null, |
|
| 86 | - esc_html__('Country for the state', 'event_espresso') |
|
| 87 | - ), |
|
| 88 | - new GraphQLInputField( |
|
| 89 | - 'country', |
|
| 90 | - 'String', |
|
| 91 | - null, |
|
| 92 | - esc_html__('Country ISO Code', 'event_espresso') |
|
| 93 | - ), |
|
| 94 | - ]; |
|
| 39 | + /** |
|
| 40 | + * @return GraphQLFieldInterface[] |
|
| 41 | + * @since $VID:$ |
|
| 42 | + */ |
|
| 43 | + public function getFields() |
|
| 44 | + { |
|
| 45 | + $fields = [ |
|
| 46 | + new GraphQLField( |
|
| 47 | + 'id', |
|
| 48 | + ['non_null' => 'ID'], |
|
| 49 | + null, |
|
| 50 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 51 | + ), |
|
| 52 | + new GraphQLOutputField( |
|
| 53 | + 'dbId', |
|
| 54 | + ['non_null' => 'Int'], |
|
| 55 | + 'ID', |
|
| 56 | + esc_html__('State ID', 'event_espresso') |
|
| 57 | + ), |
|
| 58 | + new GraphQLField( |
|
| 59 | + 'abbreviation', |
|
| 60 | + 'String', |
|
| 61 | + 'abbrev', |
|
| 62 | + esc_html__('State Abbreviation', 'event_espresso') |
|
| 63 | + ), |
|
| 64 | + new GraphQLOutputField( |
|
| 65 | + 'cacheId', |
|
| 66 | + ['non_null' => 'String'], |
|
| 67 | + null, |
|
| 68 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 69 | + ), |
|
| 70 | + new GraphQLField( |
|
| 71 | + 'name', |
|
| 72 | + 'String', |
|
| 73 | + 'name', |
|
| 74 | + esc_html__('State Name', 'event_espresso') |
|
| 75 | + ), |
|
| 76 | + new GraphQLField( |
|
| 77 | + 'isActive', |
|
| 78 | + 'Boolean', |
|
| 79 | + 'active', |
|
| 80 | + esc_html__('State Active Flag', 'event_espresso') |
|
| 81 | + ), |
|
| 82 | + new GraphQLOutputField( |
|
| 83 | + 'country', |
|
| 84 | + $this->namespace . 'Country', |
|
| 85 | + null, |
|
| 86 | + esc_html__('Country for the state', 'event_espresso') |
|
| 87 | + ), |
|
| 88 | + new GraphQLInputField( |
|
| 89 | + 'country', |
|
| 90 | + 'String', |
|
| 91 | + null, |
|
| 92 | + esc_html__('Country ISO Code', 'event_espresso') |
|
| 93 | + ), |
|
| 94 | + ]; |
|
| 95 | 95 | |
| 96 | - return apply_filters( |
|
| 97 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__state_fields', |
|
| 98 | - $fields, |
|
| 99 | - $this->name, |
|
| 100 | - $this->model |
|
| 101 | - ); |
|
| 102 | - } |
|
| 96 | + return apply_filters( |
|
| 97 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__state_fields', |
|
| 98 | + $fields, |
|
| 99 | + $this->name, |
|
| 100 | + $this->model |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | 103 | } |
@@ -22,189 +22,189 @@ |
||
| 22 | 22 | class Attendee extends TypeBase |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Attendee constructor. |
|
| 27 | - * |
|
| 28 | - * @param EEM_Attendee $attendee_model |
|
| 29 | - */ |
|
| 30 | - public function __construct(EEM_Attendee $attendee_model) |
|
| 31 | - { |
|
| 32 | - $this->model = $attendee_model; |
|
| 33 | - $this->setName($this->namespace . 'Attendee'); |
|
| 34 | - $this->setIsCustomPostType(false); // Set to false to use our model queries |
|
| 35 | - parent::__construct(); |
|
| 36 | - } |
|
| 25 | + /** |
|
| 26 | + * Attendee constructor. |
|
| 27 | + * |
|
| 28 | + * @param EEM_Attendee $attendee_model |
|
| 29 | + */ |
|
| 30 | + public function __construct(EEM_Attendee $attendee_model) |
|
| 31 | + { |
|
| 32 | + $this->model = $attendee_model; |
|
| 33 | + $this->setName($this->namespace . 'Attendee'); |
|
| 34 | + $this->setIsCustomPostType(false); // Set to false to use our model queries |
|
| 35 | + parent::__construct(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @return GraphQLFieldInterface[] |
|
| 41 | - * @since $VID:$ |
|
| 42 | - */ |
|
| 43 | - public function getFields() |
|
| 44 | - { |
|
| 45 | - $fields = [ |
|
| 46 | - new GraphQLField( |
|
| 47 | - 'id', |
|
| 48 | - ['non_null' => 'ID'], |
|
| 49 | - null, |
|
| 50 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 51 | - ), |
|
| 52 | - new GraphQLOutputField( |
|
| 53 | - 'dbId', |
|
| 54 | - ['non_null' => 'Int'], |
|
| 55 | - 'ID', |
|
| 56 | - esc_html__('The attendee ID.', 'event_espresso') |
|
| 57 | - ), |
|
| 58 | - new GraphQLOutputField( |
|
| 59 | - 'cacheId', |
|
| 60 | - ['non_null' => 'String'], |
|
| 61 | - null, |
|
| 62 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 63 | - ), |
|
| 64 | - new GraphQLOutputField( |
|
| 65 | - 'address', |
|
| 66 | - 'String', |
|
| 67 | - 'address', |
|
| 68 | - esc_html__('Address Part 1', 'event_espresso'), |
|
| 69 | - null, |
|
| 70 | - null, |
|
| 71 | - ['ee_edit_contacts'] |
|
| 72 | - ), |
|
| 73 | - new GraphQLOutputField( |
|
| 74 | - 'address2', |
|
| 75 | - 'String', |
|
| 76 | - 'address2', |
|
| 77 | - esc_html__('Address Part 2', 'event_espresso'), |
|
| 78 | - null, |
|
| 79 | - null, |
|
| 80 | - ['ee_edit_contacts'] |
|
| 81 | - ), |
|
| 82 | - new GraphQLOutputField( |
|
| 83 | - 'avatar', |
|
| 84 | - 'String', |
|
| 85 | - null, |
|
| 86 | - esc_html__('User avatar URL', 'event_espresso'), |
|
| 87 | - null, |
|
| 88 | - [$this, 'getAvatar'], |
|
| 89 | - ['ee_edit_contacts'] |
|
| 90 | - ), |
|
| 91 | - new GraphQLOutputField( |
|
| 92 | - 'bio', |
|
| 93 | - 'String', |
|
| 94 | - 'bio', |
|
| 95 | - esc_html__('Attendee Biography', 'event_espresso'), |
|
| 96 | - null, |
|
| 97 | - null, |
|
| 98 | - ['ee_edit_contacts'] |
|
| 99 | - ), |
|
| 100 | - new GraphQLOutputField( |
|
| 101 | - 'city', |
|
| 102 | - 'String', |
|
| 103 | - 'city', |
|
| 104 | - esc_html__('City', 'event_espresso'), |
|
| 105 | - null, |
|
| 106 | - null, |
|
| 107 | - ['ee_edit_contacts'] |
|
| 108 | - ), |
|
| 109 | - new GraphQLOutputField( |
|
| 110 | - 'country', |
|
| 111 | - $this->namespace . 'Country', |
|
| 112 | - null, |
|
| 113 | - esc_html__('Country', 'event_espresso'), |
|
| 114 | - null, |
|
| 115 | - null, |
|
| 116 | - ['ee_edit_contacts'] |
|
| 117 | - ), |
|
| 118 | - new GraphQLOutputField( |
|
| 119 | - 'email', |
|
| 120 | - 'String', |
|
| 121 | - 'email', |
|
| 122 | - esc_html__('Email Address', 'event_espresso'), |
|
| 123 | - null, |
|
| 124 | - null, |
|
| 125 | - ['ee_edit_contacts'] |
|
| 126 | - ), |
|
| 127 | - new GraphQLOutputField( |
|
| 128 | - 'firstName', |
|
| 129 | - 'String', |
|
| 130 | - 'fname', |
|
| 131 | - esc_html__('Attendee First Name', 'event_espresso') |
|
| 132 | - ), |
|
| 133 | - new GraphQLOutputField( |
|
| 134 | - 'fullName', |
|
| 135 | - 'String', |
|
| 136 | - 'full_name', |
|
| 137 | - esc_html__('Attendee Name', 'event_espresso') |
|
| 138 | - ), |
|
| 139 | - new GraphQLOutputField( |
|
| 140 | - 'lastName', |
|
| 141 | - 'String', |
|
| 142 | - 'lname', |
|
| 143 | - esc_html__('Attendee Last Name', 'event_espresso') |
|
| 144 | - ), |
|
| 145 | - new GraphQLOutputField( |
|
| 146 | - 'phone', |
|
| 147 | - 'String', |
|
| 148 | - 'phone', |
|
| 149 | - esc_html__('Phone', 'event_espresso'), |
|
| 150 | - null, |
|
| 151 | - null, |
|
| 152 | - ['ee_edit_contacts'] |
|
| 153 | - ), |
|
| 154 | - new GraphQLOutputField( |
|
| 155 | - 'shortBio', |
|
| 156 | - 'String', |
|
| 157 | - 'short_bio', |
|
| 158 | - esc_html__('Attendee Short Biography', 'event_espresso'), |
|
| 159 | - null, |
|
| 160 | - null, |
|
| 161 | - ['ee_edit_contacts'] |
|
| 162 | - ), |
|
| 163 | - new GraphQLOutputField( |
|
| 164 | - 'state', |
|
| 165 | - $this->namespace . 'State', |
|
| 166 | - null, |
|
| 167 | - esc_html__('State', 'event_espresso'), |
|
| 168 | - null, |
|
| 169 | - null, |
|
| 170 | - ['ee_edit_contacts'] |
|
| 171 | - ), |
|
| 172 | - new GraphQLOutputField( |
|
| 173 | - 'zip', |
|
| 174 | - 'String', |
|
| 175 | - 'zip', |
|
| 176 | - esc_html__('ZIP/Postal Code', 'event_espresso'), |
|
| 177 | - null, |
|
| 178 | - null, |
|
| 179 | - ['ee_edit_contacts'] |
|
| 180 | - ), |
|
| 181 | - ]; |
|
| 39 | + /** |
|
| 40 | + * @return GraphQLFieldInterface[] |
|
| 41 | + * @since $VID:$ |
|
| 42 | + */ |
|
| 43 | + public function getFields() |
|
| 44 | + { |
|
| 45 | + $fields = [ |
|
| 46 | + new GraphQLField( |
|
| 47 | + 'id', |
|
| 48 | + ['non_null' => 'ID'], |
|
| 49 | + null, |
|
| 50 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 51 | + ), |
|
| 52 | + new GraphQLOutputField( |
|
| 53 | + 'dbId', |
|
| 54 | + ['non_null' => 'Int'], |
|
| 55 | + 'ID', |
|
| 56 | + esc_html__('The attendee ID.', 'event_espresso') |
|
| 57 | + ), |
|
| 58 | + new GraphQLOutputField( |
|
| 59 | + 'cacheId', |
|
| 60 | + ['non_null' => 'String'], |
|
| 61 | + null, |
|
| 62 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 63 | + ), |
|
| 64 | + new GraphQLOutputField( |
|
| 65 | + 'address', |
|
| 66 | + 'String', |
|
| 67 | + 'address', |
|
| 68 | + esc_html__('Address Part 1', 'event_espresso'), |
|
| 69 | + null, |
|
| 70 | + null, |
|
| 71 | + ['ee_edit_contacts'] |
|
| 72 | + ), |
|
| 73 | + new GraphQLOutputField( |
|
| 74 | + 'address2', |
|
| 75 | + 'String', |
|
| 76 | + 'address2', |
|
| 77 | + esc_html__('Address Part 2', 'event_espresso'), |
|
| 78 | + null, |
|
| 79 | + null, |
|
| 80 | + ['ee_edit_contacts'] |
|
| 81 | + ), |
|
| 82 | + new GraphQLOutputField( |
|
| 83 | + 'avatar', |
|
| 84 | + 'String', |
|
| 85 | + null, |
|
| 86 | + esc_html__('User avatar URL', 'event_espresso'), |
|
| 87 | + null, |
|
| 88 | + [$this, 'getAvatar'], |
|
| 89 | + ['ee_edit_contacts'] |
|
| 90 | + ), |
|
| 91 | + new GraphQLOutputField( |
|
| 92 | + 'bio', |
|
| 93 | + 'String', |
|
| 94 | + 'bio', |
|
| 95 | + esc_html__('Attendee Biography', 'event_espresso'), |
|
| 96 | + null, |
|
| 97 | + null, |
|
| 98 | + ['ee_edit_contacts'] |
|
| 99 | + ), |
|
| 100 | + new GraphQLOutputField( |
|
| 101 | + 'city', |
|
| 102 | + 'String', |
|
| 103 | + 'city', |
|
| 104 | + esc_html__('City', 'event_espresso'), |
|
| 105 | + null, |
|
| 106 | + null, |
|
| 107 | + ['ee_edit_contacts'] |
|
| 108 | + ), |
|
| 109 | + new GraphQLOutputField( |
|
| 110 | + 'country', |
|
| 111 | + $this->namespace . 'Country', |
|
| 112 | + null, |
|
| 113 | + esc_html__('Country', 'event_espresso'), |
|
| 114 | + null, |
|
| 115 | + null, |
|
| 116 | + ['ee_edit_contacts'] |
|
| 117 | + ), |
|
| 118 | + new GraphQLOutputField( |
|
| 119 | + 'email', |
|
| 120 | + 'String', |
|
| 121 | + 'email', |
|
| 122 | + esc_html__('Email Address', 'event_espresso'), |
|
| 123 | + null, |
|
| 124 | + null, |
|
| 125 | + ['ee_edit_contacts'] |
|
| 126 | + ), |
|
| 127 | + new GraphQLOutputField( |
|
| 128 | + 'firstName', |
|
| 129 | + 'String', |
|
| 130 | + 'fname', |
|
| 131 | + esc_html__('Attendee First Name', 'event_espresso') |
|
| 132 | + ), |
|
| 133 | + new GraphQLOutputField( |
|
| 134 | + 'fullName', |
|
| 135 | + 'String', |
|
| 136 | + 'full_name', |
|
| 137 | + esc_html__('Attendee Name', 'event_espresso') |
|
| 138 | + ), |
|
| 139 | + new GraphQLOutputField( |
|
| 140 | + 'lastName', |
|
| 141 | + 'String', |
|
| 142 | + 'lname', |
|
| 143 | + esc_html__('Attendee Last Name', 'event_espresso') |
|
| 144 | + ), |
|
| 145 | + new GraphQLOutputField( |
|
| 146 | + 'phone', |
|
| 147 | + 'String', |
|
| 148 | + 'phone', |
|
| 149 | + esc_html__('Phone', 'event_espresso'), |
|
| 150 | + null, |
|
| 151 | + null, |
|
| 152 | + ['ee_edit_contacts'] |
|
| 153 | + ), |
|
| 154 | + new GraphQLOutputField( |
|
| 155 | + 'shortBio', |
|
| 156 | + 'String', |
|
| 157 | + 'short_bio', |
|
| 158 | + esc_html__('Attendee Short Biography', 'event_espresso'), |
|
| 159 | + null, |
|
| 160 | + null, |
|
| 161 | + ['ee_edit_contacts'] |
|
| 162 | + ), |
|
| 163 | + new GraphQLOutputField( |
|
| 164 | + 'state', |
|
| 165 | + $this->namespace . 'State', |
|
| 166 | + null, |
|
| 167 | + esc_html__('State', 'event_espresso'), |
|
| 168 | + null, |
|
| 169 | + null, |
|
| 170 | + ['ee_edit_contacts'] |
|
| 171 | + ), |
|
| 172 | + new GraphQLOutputField( |
|
| 173 | + 'zip', |
|
| 174 | + 'String', |
|
| 175 | + 'zip', |
|
| 176 | + esc_html__('ZIP/Postal Code', 'event_espresso'), |
|
| 177 | + null, |
|
| 178 | + null, |
|
| 179 | + ['ee_edit_contacts'] |
|
| 180 | + ), |
|
| 181 | + ]; |
|
| 182 | 182 | |
| 183 | - return apply_filters( |
|
| 184 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__attendee_fields', |
|
| 185 | - $fields, |
|
| 186 | - $this->name, |
|
| 187 | - $this->model |
|
| 188 | - ); |
|
| 189 | - } |
|
| 183 | + return apply_filters( |
|
| 184 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__attendee_fields', |
|
| 185 | + $fields, |
|
| 186 | + $this->name, |
|
| 187 | + $this->model |
|
| 188 | + ); |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | 191 | |
| 192 | - /** |
|
| 193 | - * @param EE_Attendee $source The source that's passed down the GraphQL queries |
|
| 194 | - * @param array $args The inputArgs on the field |
|
| 195 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
| 196 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
| 197 | - * @return string |
|
| 198 | - * @since $VID:$ |
|
| 199 | - */ |
|
| 200 | - public function getAvatar(EE_Attendee $source, array $args, AppContext $context, ResolveInfo $info) |
|
| 201 | - { |
|
| 202 | - $email = $source->email(); |
|
| 192 | + /** |
|
| 193 | + * @param EE_Attendee $source The source that's passed down the GraphQL queries |
|
| 194 | + * @param array $args The inputArgs on the field |
|
| 195 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
| 196 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
| 197 | + * @return string |
|
| 198 | + * @since $VID:$ |
|
| 199 | + */ |
|
| 200 | + public function getAvatar(EE_Attendee $source, array $args, AppContext $context, ResolveInfo $info) |
|
| 201 | + { |
|
| 202 | + $email = $source->email(); |
|
| 203 | 203 | |
| 204 | - if (empty($email)) { |
|
| 205 | - return get_avatar_url('', array('force_default' => true)); |
|
| 206 | - } |
|
| 207 | - $avatar = get_avatar_url($email); |
|
| 208 | - return $avatar ? $avatar : null; |
|
| 209 | - } |
|
| 204 | + if (empty($email)) { |
|
| 205 | + return get_avatar_url('', array('force_default' => true)); |
|
| 206 | + } |
|
| 207 | + $avatar = get_avatar_url($email); |
|
| 208 | + return $avatar ? $avatar : null; |
|
| 209 | + } |
|
| 210 | 210 | } |
@@ -19,122 +19,122 @@ |
||
| 19 | 19 | class Country extends TypeBase |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Country constructor. |
|
| 24 | - * |
|
| 25 | - * @param EEM_Country $country_model |
|
| 26 | - */ |
|
| 27 | - public function __construct(EEM_Country $country_model) |
|
| 28 | - { |
|
| 29 | - $this->model = $country_model; |
|
| 30 | - $this->setName($this->namespace . 'Country'); |
|
| 31 | - $this->setDescription(__('A country', 'event_espresso')); |
|
| 32 | - $this->setIsCustomPostType(false); |
|
| 33 | - parent::__construct(); |
|
| 34 | - } |
|
| 22 | + /** |
|
| 23 | + * Country constructor. |
|
| 24 | + * |
|
| 25 | + * @param EEM_Country $country_model |
|
| 26 | + */ |
|
| 27 | + public function __construct(EEM_Country $country_model) |
|
| 28 | + { |
|
| 29 | + $this->model = $country_model; |
|
| 30 | + $this->setName($this->namespace . 'Country'); |
|
| 31 | + $this->setDescription(__('A country', 'event_espresso')); |
|
| 32 | + $this->setIsCustomPostType(false); |
|
| 33 | + parent::__construct(); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @return GraphQLFieldInterface[] |
|
| 39 | - * @since $VID:$ |
|
| 40 | - */ |
|
| 41 | - public function getFields() |
|
| 42 | - { |
|
| 43 | - $fields = [ |
|
| 44 | - new GraphQLField( |
|
| 45 | - 'id', |
|
| 46 | - ['non_null' => 'ID'], |
|
| 47 | - null, |
|
| 48 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 49 | - ), |
|
| 50 | - new GraphQLOutputField( |
|
| 51 | - 'cacheId', |
|
| 52 | - ['non_null' => 'String'], |
|
| 53 | - null, |
|
| 54 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 55 | - ), |
|
| 56 | - new GraphQLField( |
|
| 57 | - 'isActive', |
|
| 58 | - 'Boolean', |
|
| 59 | - null, // 'active', |
|
| 60 | - esc_html__( |
|
| 61 | - 'Flag that indicates if the country should appear in dropdown select lists', |
|
| 62 | - 'event_espresso' |
|
| 63 | - ) |
|
| 64 | - ), |
|
| 65 | - new GraphQLField( |
|
| 66 | - 'ISO', |
|
| 67 | - 'String', |
|
| 68 | - null, // 'ISO', |
|
| 69 | - esc_html__('Country ISO Code', 'event_espresso') |
|
| 70 | - ), |
|
| 71 | - new GraphQLField( |
|
| 72 | - 'ISO3', |
|
| 73 | - 'String', |
|
| 74 | - null, // 'ISO3', |
|
| 75 | - esc_html__('Country ISO3 Code', 'event_espresso') |
|
| 76 | - ), |
|
| 77 | - new GraphQLField( |
|
| 78 | - 'name', |
|
| 79 | - 'String', |
|
| 80 | - 'name', |
|
| 81 | - esc_html__('Country Name', 'event_espresso') |
|
| 82 | - ), |
|
| 83 | - new GraphQLField( |
|
| 84 | - 'currencyCode', |
|
| 85 | - 'String', |
|
| 86 | - 'currency_code', |
|
| 87 | - esc_html__('Country Currency Code', 'event_espresso') |
|
| 88 | - ), |
|
| 89 | - new GraphQLField( |
|
| 90 | - 'currencySingular', |
|
| 91 | - 'String', |
|
| 92 | - 'currency_name_single', |
|
| 93 | - esc_html__('Currency Name Singular', 'event_espresso') |
|
| 94 | - ), |
|
| 95 | - new GraphQLField( |
|
| 96 | - 'currencyPlural', |
|
| 97 | - 'String', |
|
| 98 | - 'currency_name_plural', |
|
| 99 | - esc_html__('Currency Name Plural', 'event_espresso') |
|
| 100 | - ), |
|
| 101 | - new GraphQLField( |
|
| 102 | - 'currencySign', |
|
| 103 | - 'String', |
|
| 104 | - 'currency_sign', |
|
| 105 | - __('Currency Sign', 'event_espresso') |
|
| 106 | - ), |
|
| 107 | - new GraphQLField( |
|
| 108 | - 'currencySignBeforeNumber', |
|
| 109 | - 'String', |
|
| 110 | - 'currency_sign_before', |
|
| 111 | - esc_html__('Currency Sign Before Number', 'event_espresso') |
|
| 112 | - ), |
|
| 113 | - new GraphQLField( |
|
| 114 | - 'currencyDecimalPlaces', |
|
| 115 | - 'String', |
|
| 116 | - 'currency_decimal_places', |
|
| 117 | - esc_html__('Currency Decimal Places', 'event_espresso') |
|
| 118 | - ), |
|
| 119 | - new GraphQLField( |
|
| 120 | - 'currencyDecimalMark', |
|
| 121 | - 'String', |
|
| 122 | - 'currency_decimal_mark', |
|
| 123 | - esc_html__('Currency Decimal Mark', 'event_espresso') |
|
| 124 | - ), |
|
| 125 | - new GraphQLField( |
|
| 126 | - 'currencyThousandsSeparator', |
|
| 127 | - 'String', |
|
| 128 | - 'currency_thousands_separator', |
|
| 129 | - esc_html__('Currency Thousands Separator', 'event_espresso') |
|
| 130 | - ), |
|
| 131 | - ]; |
|
| 37 | + /** |
|
| 38 | + * @return GraphQLFieldInterface[] |
|
| 39 | + * @since $VID:$ |
|
| 40 | + */ |
|
| 41 | + public function getFields() |
|
| 42 | + { |
|
| 43 | + $fields = [ |
|
| 44 | + new GraphQLField( |
|
| 45 | + 'id', |
|
| 46 | + ['non_null' => 'ID'], |
|
| 47 | + null, |
|
| 48 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 49 | + ), |
|
| 50 | + new GraphQLOutputField( |
|
| 51 | + 'cacheId', |
|
| 52 | + ['non_null' => 'String'], |
|
| 53 | + null, |
|
| 54 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 55 | + ), |
|
| 56 | + new GraphQLField( |
|
| 57 | + 'isActive', |
|
| 58 | + 'Boolean', |
|
| 59 | + null, // 'active', |
|
| 60 | + esc_html__( |
|
| 61 | + 'Flag that indicates if the country should appear in dropdown select lists', |
|
| 62 | + 'event_espresso' |
|
| 63 | + ) |
|
| 64 | + ), |
|
| 65 | + new GraphQLField( |
|
| 66 | + 'ISO', |
|
| 67 | + 'String', |
|
| 68 | + null, // 'ISO', |
|
| 69 | + esc_html__('Country ISO Code', 'event_espresso') |
|
| 70 | + ), |
|
| 71 | + new GraphQLField( |
|
| 72 | + 'ISO3', |
|
| 73 | + 'String', |
|
| 74 | + null, // 'ISO3', |
|
| 75 | + esc_html__('Country ISO3 Code', 'event_espresso') |
|
| 76 | + ), |
|
| 77 | + new GraphQLField( |
|
| 78 | + 'name', |
|
| 79 | + 'String', |
|
| 80 | + 'name', |
|
| 81 | + esc_html__('Country Name', 'event_espresso') |
|
| 82 | + ), |
|
| 83 | + new GraphQLField( |
|
| 84 | + 'currencyCode', |
|
| 85 | + 'String', |
|
| 86 | + 'currency_code', |
|
| 87 | + esc_html__('Country Currency Code', 'event_espresso') |
|
| 88 | + ), |
|
| 89 | + new GraphQLField( |
|
| 90 | + 'currencySingular', |
|
| 91 | + 'String', |
|
| 92 | + 'currency_name_single', |
|
| 93 | + esc_html__('Currency Name Singular', 'event_espresso') |
|
| 94 | + ), |
|
| 95 | + new GraphQLField( |
|
| 96 | + 'currencyPlural', |
|
| 97 | + 'String', |
|
| 98 | + 'currency_name_plural', |
|
| 99 | + esc_html__('Currency Name Plural', 'event_espresso') |
|
| 100 | + ), |
|
| 101 | + new GraphQLField( |
|
| 102 | + 'currencySign', |
|
| 103 | + 'String', |
|
| 104 | + 'currency_sign', |
|
| 105 | + __('Currency Sign', 'event_espresso') |
|
| 106 | + ), |
|
| 107 | + new GraphQLField( |
|
| 108 | + 'currencySignBeforeNumber', |
|
| 109 | + 'String', |
|
| 110 | + 'currency_sign_before', |
|
| 111 | + esc_html__('Currency Sign Before Number', 'event_espresso') |
|
| 112 | + ), |
|
| 113 | + new GraphQLField( |
|
| 114 | + 'currencyDecimalPlaces', |
|
| 115 | + 'String', |
|
| 116 | + 'currency_decimal_places', |
|
| 117 | + esc_html__('Currency Decimal Places', 'event_espresso') |
|
| 118 | + ), |
|
| 119 | + new GraphQLField( |
|
| 120 | + 'currencyDecimalMark', |
|
| 121 | + 'String', |
|
| 122 | + 'currency_decimal_mark', |
|
| 123 | + esc_html__('Currency Decimal Mark', 'event_espresso') |
|
| 124 | + ), |
|
| 125 | + new GraphQLField( |
|
| 126 | + 'currencyThousandsSeparator', |
|
| 127 | + 'String', |
|
| 128 | + 'currency_thousands_separator', |
|
| 129 | + esc_html__('Currency Thousands Separator', 'event_espresso') |
|
| 130 | + ), |
|
| 131 | + ]; |
|
| 132 | 132 | |
| 133 | - return apply_filters( |
|
| 134 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__country_fields', |
|
| 135 | - $fields, |
|
| 136 | - $this->name, |
|
| 137 | - $this->model |
|
| 138 | - ); |
|
| 139 | - } |
|
| 133 | + return apply_filters( |
|
| 134 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__country_fields', |
|
| 135 | + $fields, |
|
| 136 | + $this->name, |
|
| 137 | + $this->model |
|
| 138 | + ); |
|
| 139 | + } |
|
| 140 | 140 | } |