@@ -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 | } |
@@ -33,363 +33,363 @@ |
||
| 33 | 33 | class Ticket extends TypeBase |
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Ticket constructor. |
|
| 38 | - * |
|
| 39 | - * @param EEM_Ticket $ticket_model |
|
| 40 | - */ |
|
| 41 | - public function __construct(EEM_Ticket $ticket_model) |
|
| 42 | - { |
|
| 43 | - $this->model = $ticket_model; |
|
| 44 | - $this->setName($this->namespace . 'Ticket'); |
|
| 45 | - $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
| 46 | - $this->setIsCustomPostType(false); |
|
| 47 | - parent::__construct(); |
|
| 48 | - } |
|
| 36 | + /** |
|
| 37 | + * Ticket constructor. |
|
| 38 | + * |
|
| 39 | + * @param EEM_Ticket $ticket_model |
|
| 40 | + */ |
|
| 41 | + public function __construct(EEM_Ticket $ticket_model) |
|
| 42 | + { |
|
| 43 | + $this->model = $ticket_model; |
|
| 44 | + $this->setName($this->namespace . 'Ticket'); |
|
| 45 | + $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
| 46 | + $this->setIsCustomPostType(false); |
|
| 47 | + parent::__construct(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return GraphQLFieldInterface[] |
|
| 53 | - * @since $VID:$ |
|
| 54 | - */ |
|
| 55 | - public function getFields() |
|
| 56 | - { |
|
| 57 | - $fields = [ |
|
| 58 | - new GraphQLField( |
|
| 59 | - 'id', |
|
| 60 | - ['non_null' => 'ID'], |
|
| 61 | - null, |
|
| 62 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 63 | - ), |
|
| 64 | - new GraphQLOutputField( |
|
| 65 | - 'dbId', |
|
| 66 | - ['non_null' => 'Int'], |
|
| 67 | - 'ID', |
|
| 68 | - esc_html__('Ticket ID', 'event_espresso') |
|
| 69 | - ), |
|
| 70 | - new GraphQLOutputField( |
|
| 71 | - 'cacheId', |
|
| 72 | - ['non_null' => 'String'], |
|
| 73 | - null, |
|
| 74 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 75 | - ), |
|
| 76 | - new GraphQLInputField( |
|
| 77 | - 'datetimes', |
|
| 78 | - ['list_of' => 'ID'], |
|
| 79 | - null, |
|
| 80 | - sprintf( |
|
| 81 | - '%1$s %2$s', |
|
| 82 | - esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
| 83 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
| 84 | - ) |
|
| 85 | - ), |
|
| 86 | - new GraphQLField( |
|
| 87 | - 'description', |
|
| 88 | - 'String', |
|
| 89 | - 'description', |
|
| 90 | - esc_html__('Description of Ticket', 'event_espresso') |
|
| 91 | - ), |
|
| 92 | - new GraphQLField( |
|
| 93 | - 'endDate', |
|
| 94 | - 'String', |
|
| 95 | - 'end_date', |
|
| 96 | - esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
| 97 | - [$this, 'formatDatetime'] |
|
| 98 | - ), |
|
| 99 | - new GraphQLOutputField( |
|
| 100 | - 'event', |
|
| 101 | - $this->namespace . 'Event', |
|
| 102 | - null, |
|
| 103 | - esc_html__('Event of the ticket.', 'event_espresso') |
|
| 104 | - ), |
|
| 105 | - new GraphQLField( |
|
| 106 | - 'isDefault', |
|
| 107 | - 'Boolean', |
|
| 108 | - 'is_default', |
|
| 109 | - esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
| 110 | - ), |
|
| 111 | - new GraphQLOutputField( |
|
| 112 | - 'isExpired', |
|
| 113 | - 'Boolean', |
|
| 114 | - 'is_expired', |
|
| 115 | - esc_html__('Flag indicating ticket is no longer available because its available dates have expired', 'event_espresso') |
|
| 116 | - ), |
|
| 117 | - new GraphQLOutputField( |
|
| 118 | - 'isFree', |
|
| 119 | - 'Boolean', |
|
| 120 | - 'is_free', |
|
| 121 | - esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
| 122 | - ), |
|
| 123 | - new GraphQLOutputField( |
|
| 124 | - 'isOnSale', |
|
| 125 | - 'Boolean', |
|
| 126 | - 'is_on_sale', |
|
| 127 | - esc_html__('Flag indicating ticket ticket is on sale or not', 'event_espresso') |
|
| 128 | - ), |
|
| 129 | - new GraphQLOutputField( |
|
| 130 | - 'isPending', |
|
| 131 | - 'Boolean', |
|
| 132 | - 'is_pending', |
|
| 133 | - esc_html__('Flag indicating ticket is yet to go on sale or not', 'event_espresso') |
|
| 134 | - ), |
|
| 135 | - new GraphQLField( |
|
| 136 | - 'isRequired', |
|
| 137 | - 'Boolean', |
|
| 138 | - 'required', |
|
| 139 | - esc_html__( |
|
| 140 | - 'Flag indicating whether this ticket must be purchased with a transaction', |
|
| 141 | - 'event_espresso' |
|
| 142 | - ) |
|
| 143 | - ), |
|
| 144 | - new GraphQLOutputField( |
|
| 145 | - 'isSoldOut', |
|
| 146 | - 'Boolean', |
|
| 147 | - null, |
|
| 148 | - esc_html__('Flag indicating whether the ticket is sold out', 'event_espresso'), |
|
| 149 | - null, |
|
| 150 | - [$this, 'getIsSoldOut'] |
|
| 151 | - ), |
|
| 152 | - new GraphQLField( |
|
| 153 | - 'isTaxable', |
|
| 154 | - 'Boolean', |
|
| 155 | - 'taxable', |
|
| 156 | - esc_html__( |
|
| 157 | - 'Flag indicating whether there is tax applied on this ticket', |
|
| 158 | - 'event_espresso' |
|
| 159 | - ) |
|
| 160 | - ), |
|
| 161 | - new GraphQLField( |
|
| 162 | - 'isTrashed', |
|
| 163 | - 'Boolean', |
|
| 164 | - 'deleted', |
|
| 165 | - esc_html__('Flag indicating ticket has been trashed.', 'event_espresso') |
|
| 166 | - ), |
|
| 167 | - new GraphQLField( |
|
| 168 | - 'max', |
|
| 169 | - 'Int', |
|
| 170 | - 'max', |
|
| 171 | - esc_html__( |
|
| 172 | - 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
| 173 | - 'event_espresso' |
|
| 174 | - ), |
|
| 175 | - [$this, 'parseInfiniteValue'] |
|
| 176 | - ), |
|
| 177 | - new GraphQLField( |
|
| 178 | - 'min', |
|
| 179 | - 'Int', |
|
| 180 | - 'min', |
|
| 181 | - esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
| 182 | - ), |
|
| 183 | - new GraphQLField( |
|
| 184 | - 'name', |
|
| 185 | - 'String', |
|
| 186 | - 'name', |
|
| 187 | - esc_html__('Ticket Name', 'event_espresso') |
|
| 188 | - ), |
|
| 189 | - new GraphQLField( |
|
| 190 | - 'order', |
|
| 191 | - 'Int', |
|
| 192 | - 'order', |
|
| 193 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
| 194 | - ), |
|
| 195 | - new GraphQLOutputField( |
|
| 196 | - 'parent', |
|
| 197 | - $this->name(), |
|
| 198 | - null, |
|
| 199 | - esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
| 200 | - ), |
|
| 201 | - new GraphQLInputField( |
|
| 202 | - 'parent', |
|
| 203 | - 'ID', |
|
| 204 | - null, |
|
| 205 | - esc_html__('The parent ticket ID', 'event_espresso') |
|
| 206 | - ), |
|
| 207 | - new GraphQLField( |
|
| 208 | - 'price', |
|
| 209 | - 'Float', |
|
| 210 | - 'price', |
|
| 211 | - esc_html__('Final calculated price for ticket', 'event_espresso') |
|
| 212 | - ), |
|
| 213 | - new GraphQLInputField( |
|
| 214 | - 'prices', |
|
| 215 | - ['list_of' => 'ID'], |
|
| 216 | - null, |
|
| 217 | - sprintf( |
|
| 218 | - '%1$s %2$s', |
|
| 219 | - esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
| 220 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
| 221 | - ) |
|
| 222 | - ), |
|
| 223 | - new GraphQLField( |
|
| 224 | - 'quantity', |
|
| 225 | - 'Int', |
|
| 226 | - 'qty', |
|
| 227 | - esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
| 228 | - [$this, 'parseInfiniteValue'] |
|
| 229 | - ), |
|
| 230 | - new GraphQLOutputField( |
|
| 231 | - 'registrationCount', |
|
| 232 | - 'Int', |
|
| 233 | - 'count_registrations', |
|
| 234 | - esc_html__('Number of registrations for the ticket', 'event_espresso') |
|
| 235 | - ), |
|
| 236 | - new GraphQLField( |
|
| 237 | - 'reserved', |
|
| 238 | - 'Int', |
|
| 239 | - 'reserved', |
|
| 240 | - esc_html__( |
|
| 241 | - 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
| 242 | - 'event_espresso' |
|
| 243 | - ) |
|
| 244 | - ), |
|
| 245 | - new GraphQLField( |
|
| 246 | - 'reverseCalculate', |
|
| 247 | - 'Boolean', |
|
| 248 | - 'reverse_calculate', |
|
| 249 | - esc_html__( |
|
| 250 | - 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
| 251 | - 'event_espresso' |
|
| 252 | - ) |
|
| 253 | - ), |
|
| 254 | - new GraphQLField( |
|
| 255 | - 'row', |
|
| 256 | - 'Int', |
|
| 257 | - 'row', |
|
| 258 | - esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
| 259 | - ), |
|
| 260 | - new GraphQLField( |
|
| 261 | - 'sold', |
|
| 262 | - 'Int', |
|
| 263 | - 'sold', |
|
| 264 | - esc_html__('Number of this ticket sold', 'event_espresso') |
|
| 265 | - ), |
|
| 266 | - new GraphQLOutputField( |
|
| 267 | - 'status', |
|
| 268 | - $this->namespace . 'TicketStatusEnum', |
|
| 269 | - 'ticket_status', |
|
| 270 | - esc_html__('Ticket status', 'event_espresso') |
|
| 271 | - ), |
|
| 272 | - new GraphQLField( |
|
| 273 | - 'startDate', |
|
| 274 | - 'String', |
|
| 275 | - 'start_date', |
|
| 276 | - esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
| 277 | - [$this, 'formatDatetime'] |
|
| 278 | - ), |
|
| 279 | - new GraphQLField( |
|
| 280 | - 'uses', |
|
| 281 | - 'Int', |
|
| 282 | - 'uses', |
|
| 283 | - esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
| 284 | - [$this, 'parseInfiniteValue'] |
|
| 285 | - ), |
|
| 286 | - new GraphQLOutputField( |
|
| 287 | - 'wpUser', |
|
| 288 | - 'User', |
|
| 289 | - null, |
|
| 290 | - esc_html__('Ticket Creator', 'event_espresso') |
|
| 291 | - ), |
|
| 292 | - new GraphQLInputField( |
|
| 293 | - 'wpUser', |
|
| 294 | - 'Int', |
|
| 295 | - null, |
|
| 296 | - esc_html__('Ticket Creator ID', 'event_espresso') |
|
| 297 | - ), |
|
| 298 | - ]; |
|
| 51 | + /** |
|
| 52 | + * @return GraphQLFieldInterface[] |
|
| 53 | + * @since $VID:$ |
|
| 54 | + */ |
|
| 55 | + public function getFields() |
|
| 56 | + { |
|
| 57 | + $fields = [ |
|
| 58 | + new GraphQLField( |
|
| 59 | + 'id', |
|
| 60 | + ['non_null' => 'ID'], |
|
| 61 | + null, |
|
| 62 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
| 63 | + ), |
|
| 64 | + new GraphQLOutputField( |
|
| 65 | + 'dbId', |
|
| 66 | + ['non_null' => 'Int'], |
|
| 67 | + 'ID', |
|
| 68 | + esc_html__('Ticket ID', 'event_espresso') |
|
| 69 | + ), |
|
| 70 | + new GraphQLOutputField( |
|
| 71 | + 'cacheId', |
|
| 72 | + ['non_null' => 'String'], |
|
| 73 | + null, |
|
| 74 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 75 | + ), |
|
| 76 | + new GraphQLInputField( |
|
| 77 | + 'datetimes', |
|
| 78 | + ['list_of' => 'ID'], |
|
| 79 | + null, |
|
| 80 | + sprintf( |
|
| 81 | + '%1$s %2$s', |
|
| 82 | + esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
| 83 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
| 84 | + ) |
|
| 85 | + ), |
|
| 86 | + new GraphQLField( |
|
| 87 | + 'description', |
|
| 88 | + 'String', |
|
| 89 | + 'description', |
|
| 90 | + esc_html__('Description of Ticket', 'event_espresso') |
|
| 91 | + ), |
|
| 92 | + new GraphQLField( |
|
| 93 | + 'endDate', |
|
| 94 | + 'String', |
|
| 95 | + 'end_date', |
|
| 96 | + esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
| 97 | + [$this, 'formatDatetime'] |
|
| 98 | + ), |
|
| 99 | + new GraphQLOutputField( |
|
| 100 | + 'event', |
|
| 101 | + $this->namespace . 'Event', |
|
| 102 | + null, |
|
| 103 | + esc_html__('Event of the ticket.', 'event_espresso') |
|
| 104 | + ), |
|
| 105 | + new GraphQLField( |
|
| 106 | + 'isDefault', |
|
| 107 | + 'Boolean', |
|
| 108 | + 'is_default', |
|
| 109 | + esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
| 110 | + ), |
|
| 111 | + new GraphQLOutputField( |
|
| 112 | + 'isExpired', |
|
| 113 | + 'Boolean', |
|
| 114 | + 'is_expired', |
|
| 115 | + esc_html__('Flag indicating ticket is no longer available because its available dates have expired', 'event_espresso') |
|
| 116 | + ), |
|
| 117 | + new GraphQLOutputField( |
|
| 118 | + 'isFree', |
|
| 119 | + 'Boolean', |
|
| 120 | + 'is_free', |
|
| 121 | + esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
| 122 | + ), |
|
| 123 | + new GraphQLOutputField( |
|
| 124 | + 'isOnSale', |
|
| 125 | + 'Boolean', |
|
| 126 | + 'is_on_sale', |
|
| 127 | + esc_html__('Flag indicating ticket ticket is on sale or not', 'event_espresso') |
|
| 128 | + ), |
|
| 129 | + new GraphQLOutputField( |
|
| 130 | + 'isPending', |
|
| 131 | + 'Boolean', |
|
| 132 | + 'is_pending', |
|
| 133 | + esc_html__('Flag indicating ticket is yet to go on sale or not', 'event_espresso') |
|
| 134 | + ), |
|
| 135 | + new GraphQLField( |
|
| 136 | + 'isRequired', |
|
| 137 | + 'Boolean', |
|
| 138 | + 'required', |
|
| 139 | + esc_html__( |
|
| 140 | + 'Flag indicating whether this ticket must be purchased with a transaction', |
|
| 141 | + 'event_espresso' |
|
| 142 | + ) |
|
| 143 | + ), |
|
| 144 | + new GraphQLOutputField( |
|
| 145 | + 'isSoldOut', |
|
| 146 | + 'Boolean', |
|
| 147 | + null, |
|
| 148 | + esc_html__('Flag indicating whether the ticket is sold out', 'event_espresso'), |
|
| 149 | + null, |
|
| 150 | + [$this, 'getIsSoldOut'] |
|
| 151 | + ), |
|
| 152 | + new GraphQLField( |
|
| 153 | + 'isTaxable', |
|
| 154 | + 'Boolean', |
|
| 155 | + 'taxable', |
|
| 156 | + esc_html__( |
|
| 157 | + 'Flag indicating whether there is tax applied on this ticket', |
|
| 158 | + 'event_espresso' |
|
| 159 | + ) |
|
| 160 | + ), |
|
| 161 | + new GraphQLField( |
|
| 162 | + 'isTrashed', |
|
| 163 | + 'Boolean', |
|
| 164 | + 'deleted', |
|
| 165 | + esc_html__('Flag indicating ticket has been trashed.', 'event_espresso') |
|
| 166 | + ), |
|
| 167 | + new GraphQLField( |
|
| 168 | + 'max', |
|
| 169 | + 'Int', |
|
| 170 | + 'max', |
|
| 171 | + esc_html__( |
|
| 172 | + 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
| 173 | + 'event_espresso' |
|
| 174 | + ), |
|
| 175 | + [$this, 'parseInfiniteValue'] |
|
| 176 | + ), |
|
| 177 | + new GraphQLField( |
|
| 178 | + 'min', |
|
| 179 | + 'Int', |
|
| 180 | + 'min', |
|
| 181 | + esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
| 182 | + ), |
|
| 183 | + new GraphQLField( |
|
| 184 | + 'name', |
|
| 185 | + 'String', |
|
| 186 | + 'name', |
|
| 187 | + esc_html__('Ticket Name', 'event_espresso') |
|
| 188 | + ), |
|
| 189 | + new GraphQLField( |
|
| 190 | + 'order', |
|
| 191 | + 'Int', |
|
| 192 | + 'order', |
|
| 193 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
| 194 | + ), |
|
| 195 | + new GraphQLOutputField( |
|
| 196 | + 'parent', |
|
| 197 | + $this->name(), |
|
| 198 | + null, |
|
| 199 | + esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
| 200 | + ), |
|
| 201 | + new GraphQLInputField( |
|
| 202 | + 'parent', |
|
| 203 | + 'ID', |
|
| 204 | + null, |
|
| 205 | + esc_html__('The parent ticket ID', 'event_espresso') |
|
| 206 | + ), |
|
| 207 | + new GraphQLField( |
|
| 208 | + 'price', |
|
| 209 | + 'Float', |
|
| 210 | + 'price', |
|
| 211 | + esc_html__('Final calculated price for ticket', 'event_espresso') |
|
| 212 | + ), |
|
| 213 | + new GraphQLInputField( |
|
| 214 | + 'prices', |
|
| 215 | + ['list_of' => 'ID'], |
|
| 216 | + null, |
|
| 217 | + sprintf( |
|
| 218 | + '%1$s %2$s', |
|
| 219 | + esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
| 220 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
| 221 | + ) |
|
| 222 | + ), |
|
| 223 | + new GraphQLField( |
|
| 224 | + 'quantity', |
|
| 225 | + 'Int', |
|
| 226 | + 'qty', |
|
| 227 | + esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
| 228 | + [$this, 'parseInfiniteValue'] |
|
| 229 | + ), |
|
| 230 | + new GraphQLOutputField( |
|
| 231 | + 'registrationCount', |
|
| 232 | + 'Int', |
|
| 233 | + 'count_registrations', |
|
| 234 | + esc_html__('Number of registrations for the ticket', 'event_espresso') |
|
| 235 | + ), |
|
| 236 | + new GraphQLField( |
|
| 237 | + 'reserved', |
|
| 238 | + 'Int', |
|
| 239 | + 'reserved', |
|
| 240 | + esc_html__( |
|
| 241 | + 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
| 242 | + 'event_espresso' |
|
| 243 | + ) |
|
| 244 | + ), |
|
| 245 | + new GraphQLField( |
|
| 246 | + 'reverseCalculate', |
|
| 247 | + 'Boolean', |
|
| 248 | + 'reverse_calculate', |
|
| 249 | + esc_html__( |
|
| 250 | + 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
| 251 | + 'event_espresso' |
|
| 252 | + ) |
|
| 253 | + ), |
|
| 254 | + new GraphQLField( |
|
| 255 | + 'row', |
|
| 256 | + 'Int', |
|
| 257 | + 'row', |
|
| 258 | + esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
| 259 | + ), |
|
| 260 | + new GraphQLField( |
|
| 261 | + 'sold', |
|
| 262 | + 'Int', |
|
| 263 | + 'sold', |
|
| 264 | + esc_html__('Number of this ticket sold', 'event_espresso') |
|
| 265 | + ), |
|
| 266 | + new GraphQLOutputField( |
|
| 267 | + 'status', |
|
| 268 | + $this->namespace . 'TicketStatusEnum', |
|
| 269 | + 'ticket_status', |
|
| 270 | + esc_html__('Ticket status', 'event_espresso') |
|
| 271 | + ), |
|
| 272 | + new GraphQLField( |
|
| 273 | + 'startDate', |
|
| 274 | + 'String', |
|
| 275 | + 'start_date', |
|
| 276 | + esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
| 277 | + [$this, 'formatDatetime'] |
|
| 278 | + ), |
|
| 279 | + new GraphQLField( |
|
| 280 | + 'uses', |
|
| 281 | + 'Int', |
|
| 282 | + 'uses', |
|
| 283 | + esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
| 284 | + [$this, 'parseInfiniteValue'] |
|
| 285 | + ), |
|
| 286 | + new GraphQLOutputField( |
|
| 287 | + 'wpUser', |
|
| 288 | + 'User', |
|
| 289 | + null, |
|
| 290 | + esc_html__('Ticket Creator', 'event_espresso') |
|
| 291 | + ), |
|
| 292 | + new GraphQLInputField( |
|
| 293 | + 'wpUser', |
|
| 294 | + 'Int', |
|
| 295 | + null, |
|
| 296 | + esc_html__('Ticket Creator ID', 'event_espresso') |
|
| 297 | + ), |
|
| 298 | + ]; |
|
| 299 | 299 | |
| 300 | - return apply_filters( |
|
| 301 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__ticket_fields', |
|
| 302 | - $fields, |
|
| 303 | - $this->name, |
|
| 304 | - $this->model |
|
| 305 | - ); |
|
| 306 | - } |
|
| 300 | + return apply_filters( |
|
| 301 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__ticket_fields', |
|
| 302 | + $fields, |
|
| 303 | + $this->name, |
|
| 304 | + $this->model |
|
| 305 | + ); |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | 308 | |
| 309 | - /** |
|
| 310 | - * @param EE_Ticket $source The source that's passed down the GraphQL queries |
|
| 311 | - * @param array $args The inputArgs on the field |
|
| 312 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
| 313 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
| 314 | - * @return string |
|
| 315 | - * @throws Exception |
|
| 316 | - * @throws InvalidArgumentException |
|
| 317 | - * @throws InvalidDataTypeException |
|
| 318 | - * @throws InvalidInterfaceException |
|
| 319 | - * @throws ReflectionException |
|
| 320 | - * @throws UserError |
|
| 321 | - * @throws UnexpectedEntityException |
|
| 322 | - * @since $VID:$ |
|
| 323 | - */ |
|
| 324 | - public function getIsSoldOut(EE_Ticket $source, array $args, AppContext $context, ResolveInfo $info) |
|
| 325 | - { |
|
| 326 | - return $source->ticket_status() === EE_Ticket::sold_out; |
|
| 327 | - } |
|
| 309 | + /** |
|
| 310 | + * @param EE_Ticket $source The source that's passed down the GraphQL queries |
|
| 311 | + * @param array $args The inputArgs on the field |
|
| 312 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
| 313 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
| 314 | + * @return string |
|
| 315 | + * @throws Exception |
|
| 316 | + * @throws InvalidArgumentException |
|
| 317 | + * @throws InvalidDataTypeException |
|
| 318 | + * @throws InvalidInterfaceException |
|
| 319 | + * @throws ReflectionException |
|
| 320 | + * @throws UserError |
|
| 321 | + * @throws UnexpectedEntityException |
|
| 322 | + * @since $VID:$ |
|
| 323 | + */ |
|
| 324 | + public function getIsSoldOut(EE_Ticket $source, array $args, AppContext $context, ResolveInfo $info) |
|
| 325 | + { |
|
| 326 | + return $source->ticket_status() === EE_Ticket::sold_out; |
|
| 327 | + } |
|
| 328 | 328 | |
| 329 | 329 | |
| 330 | - /** |
|
| 331 | - * @param array $inputFields The mutation input fields. |
|
| 332 | - * @throws InvalidArgumentException |
|
| 333 | - * @throws ReflectionException |
|
| 334 | - * @since $VID:$ |
|
| 335 | - */ |
|
| 336 | - public function registerMutations(array $inputFields) |
|
| 337 | - { |
|
| 338 | - // Register mutation to update an entity. |
|
| 339 | - register_graphql_mutation( |
|
| 340 | - 'update' . $this->name(), |
|
| 341 | - [ |
|
| 342 | - 'inputFields' => $inputFields, |
|
| 343 | - 'outputFields' => [ |
|
| 344 | - lcfirst($this->name()) => [ |
|
| 345 | - 'type' => $this->name(), |
|
| 346 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 347 | - ], |
|
| 348 | - ], |
|
| 349 | - 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
| 350 | - ] |
|
| 351 | - ); |
|
| 352 | - // Register mutation to delete an entity. |
|
| 353 | - register_graphql_mutation( |
|
| 354 | - 'delete' . $this->name(), |
|
| 355 | - [ |
|
| 356 | - 'inputFields' => [ |
|
| 357 | - 'id' => $inputFields['id'], |
|
| 358 | - 'deletePermanently' => [ |
|
| 359 | - 'type' => 'Boolean', |
|
| 360 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
| 361 | - ], |
|
| 362 | - ], |
|
| 363 | - 'outputFields' => [ |
|
| 364 | - lcfirst($this->name()) => [ |
|
| 365 | - 'type' => $this->name(), |
|
| 366 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
| 367 | - 'resolve' => static function ($payload) { |
|
| 368 | - $deleted = (object) $payload['deleted']; |
|
| 330 | + /** |
|
| 331 | + * @param array $inputFields The mutation input fields. |
|
| 332 | + * @throws InvalidArgumentException |
|
| 333 | + * @throws ReflectionException |
|
| 334 | + * @since $VID:$ |
|
| 335 | + */ |
|
| 336 | + public function registerMutations(array $inputFields) |
|
| 337 | + { |
|
| 338 | + // Register mutation to update an entity. |
|
| 339 | + register_graphql_mutation( |
|
| 340 | + 'update' . $this->name(), |
|
| 341 | + [ |
|
| 342 | + 'inputFields' => $inputFields, |
|
| 343 | + 'outputFields' => [ |
|
| 344 | + lcfirst($this->name()) => [ |
|
| 345 | + 'type' => $this->name(), |
|
| 346 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 347 | + ], |
|
| 348 | + ], |
|
| 349 | + 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
| 350 | + ] |
|
| 351 | + ); |
|
| 352 | + // Register mutation to delete an entity. |
|
| 353 | + register_graphql_mutation( |
|
| 354 | + 'delete' . $this->name(), |
|
| 355 | + [ |
|
| 356 | + 'inputFields' => [ |
|
| 357 | + 'id' => $inputFields['id'], |
|
| 358 | + 'deletePermanently' => [ |
|
| 359 | + 'type' => 'Boolean', |
|
| 360 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
| 361 | + ], |
|
| 362 | + ], |
|
| 363 | + 'outputFields' => [ |
|
| 364 | + lcfirst($this->name()) => [ |
|
| 365 | + 'type' => $this->name(), |
|
| 366 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
| 367 | + 'resolve' => static function ($payload) { |
|
| 368 | + $deleted = (object) $payload['deleted']; |
|
| 369 | 369 | |
| 370 | - return ! empty($deleted) ? $deleted : null; |
|
| 371 | - }, |
|
| 372 | - ], |
|
| 373 | - ], |
|
| 374 | - 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
| 375 | - ] |
|
| 376 | - ); |
|
| 370 | + return ! empty($deleted) ? $deleted : null; |
|
| 371 | + }, |
|
| 372 | + ], |
|
| 373 | + ], |
|
| 374 | + 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
| 375 | + ] |
|
| 376 | + ); |
|
| 377 | 377 | |
| 378 | - // remove primary key from input. |
|
| 379 | - unset($inputFields['id']); |
|
| 380 | - // Register mutation to update an entity. |
|
| 381 | - register_graphql_mutation( |
|
| 382 | - 'create' . $this->name(), |
|
| 383 | - [ |
|
| 384 | - 'inputFields' => $inputFields, |
|
| 385 | - 'outputFields' => [ |
|
| 386 | - lcfirst($this->name()) => [ |
|
| 387 | - 'type' => $this->name(), |
|
| 388 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 389 | - ], |
|
| 390 | - ], |
|
| 391 | - 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
| 392 | - ] |
|
| 393 | - ); |
|
| 394 | - } |
|
| 378 | + // remove primary key from input. |
|
| 379 | + unset($inputFields['id']); |
|
| 380 | + // Register mutation to update an entity. |
|
| 381 | + register_graphql_mutation( |
|
| 382 | + 'create' . $this->name(), |
|
| 383 | + [ |
|
| 384 | + 'inputFields' => $inputFields, |
|
| 385 | + 'outputFields' => [ |
|
| 386 | + lcfirst($this->name()) => [ |
|
| 387 | + 'type' => $this->name(), |
|
| 388 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 389 | + ], |
|
| 390 | + ], |
|
| 391 | + 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
| 392 | + ] |
|
| 393 | + ); |
|
| 394 | + } |
|
| 395 | 395 | } |
@@ -234,7 +234,7 @@ |
||
| 234 | 234 | * @param array $args The inputArgs on the field |
| 235 | 235 | * @param AppContext $context The AppContext passed down the GraphQL tree |
| 236 | 236 | * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
| 237 | - * @return string |
|
| 237 | + * @return boolean |
|
| 238 | 238 | * @throws Exception |
| 239 | 239 | * @throws InvalidArgumentException |
| 240 | 240 | * @throws InvalidDataTypeException |
@@ -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 | } |