@@ -18,132 +18,132 @@ |
||
18 | 18 | */ |
19 | 19 | class TicketPricesConnection extends ConnectionBase |
20 | 20 | { |
21 | - /** |
|
22 | - * TicketConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Price $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Price $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * TicketConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Price $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Price $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => $this->namespace . 'Ticket', |
|
39 | - 'toType' => $this->namespace . 'Price', |
|
40 | - 'fromFieldName' => 'prices', |
|
41 | - 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
42 | - 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => $this->namespace . 'Ticket', |
|
39 | + 'toType' => $this->namespace . 'Price', |
|
40 | + 'fromFieldName' => 'prices', |
|
41 | + 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
42 | + 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return array|Deferred|mixed |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function resolveConnection($entity, $args, $context, $info) |
|
57 | - { |
|
58 | - $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
59 | - return $resolver->get_connection(); |
|
60 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return array|Deferred|mixed |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function resolveConnection($entity, $args, $context, $info) |
|
57 | + { |
|
58 | + $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
59 | + return $resolver->get_connection(); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * Given an optional array of args, this returns the args to be used in the connection |
|
65 | - * |
|
66 | - * @param array $args The args to modify the defaults |
|
67 | - * @return array |
|
68 | - */ |
|
69 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
70 | - public static function get_connection_args(array $args = []): array |
|
71 | - { |
|
72 | - $newArgs = [ |
|
73 | - 'in' => [ |
|
74 | - 'type' => ['list_of' => 'ID'], |
|
75 | - 'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'), |
|
76 | - ], |
|
77 | - 'idIn' => [ |
|
78 | - 'type' => ['list_of' => 'ID'], |
|
79 | - 'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'), |
|
80 | - ], |
|
81 | - 'event' => [ |
|
82 | - 'type' => 'ID', |
|
83 | - 'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'), |
|
84 | - ], |
|
85 | - 'eventId' => [ |
|
86 | - 'type' => 'Int', |
|
87 | - 'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'), |
|
88 | - ], |
|
89 | - 'includeDefaultPrices' => [ |
|
90 | - 'type' => 'Boolean', |
|
91 | - 'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'), |
|
92 | - ], |
|
93 | - 'includeDefaultTicketsPrices' => [ |
|
94 | - 'type' => 'Boolean', |
|
95 | - 'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'), |
|
96 | - ], |
|
97 | - 'isDefault' => [ |
|
98 | - 'type' => 'Boolean', |
|
99 | - 'description' => esc_html__('Filter the default prices', 'event_espresso'), |
|
100 | - ], |
|
101 | - 'ticket' => [ |
|
102 | - 'type' => 'ID', |
|
103 | - 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
104 | - ], |
|
105 | - 'ticketIn' => [ |
|
106 | - 'type' => ['list_of' => 'ID'], |
|
107 | - 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
108 | - ], |
|
109 | - 'ticketId' => [ |
|
110 | - 'type' => 'Int', |
|
111 | - 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
112 | - ], |
|
113 | - 'ticketIdIn' => [ |
|
114 | - 'type' => ['list_of' => 'Int'], |
|
115 | - 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
116 | - ], |
|
117 | - 'priceType' => [ |
|
118 | - 'type' => 'ID', |
|
119 | - 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
120 | - ], |
|
121 | - 'priceTypeIn' => [ |
|
122 | - 'type' => ['list_of' => 'ID'], |
|
123 | - 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
124 | - ], |
|
125 | - 'priceTypeId' => [ |
|
126 | - 'type' => 'Int', |
|
127 | - 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
128 | - ], |
|
129 | - 'priceTypeIdIn' => [ |
|
130 | - 'type' => ['list_of' => 'Int'], |
|
131 | - 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
132 | - ], |
|
133 | - 'priceBaseTypeIn' => [ |
|
134 | - 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
135 | - 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
136 | - ], |
|
137 | - ]; |
|
63 | + /** |
|
64 | + * Given an optional array of args, this returns the args to be used in the connection |
|
65 | + * |
|
66 | + * @param array $args The args to modify the defaults |
|
67 | + * @return array |
|
68 | + */ |
|
69 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
70 | + public static function get_connection_args(array $args = []): array |
|
71 | + { |
|
72 | + $newArgs = [ |
|
73 | + 'in' => [ |
|
74 | + 'type' => ['list_of' => 'ID'], |
|
75 | + 'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'), |
|
76 | + ], |
|
77 | + 'idIn' => [ |
|
78 | + 'type' => ['list_of' => 'ID'], |
|
79 | + 'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'), |
|
80 | + ], |
|
81 | + 'event' => [ |
|
82 | + 'type' => 'ID', |
|
83 | + 'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'), |
|
84 | + ], |
|
85 | + 'eventId' => [ |
|
86 | + 'type' => 'Int', |
|
87 | + 'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'), |
|
88 | + ], |
|
89 | + 'includeDefaultPrices' => [ |
|
90 | + 'type' => 'Boolean', |
|
91 | + 'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'), |
|
92 | + ], |
|
93 | + 'includeDefaultTicketsPrices' => [ |
|
94 | + 'type' => 'Boolean', |
|
95 | + 'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'), |
|
96 | + ], |
|
97 | + 'isDefault' => [ |
|
98 | + 'type' => 'Boolean', |
|
99 | + 'description' => esc_html__('Filter the default prices', 'event_espresso'), |
|
100 | + ], |
|
101 | + 'ticket' => [ |
|
102 | + 'type' => 'ID', |
|
103 | + 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
104 | + ], |
|
105 | + 'ticketIn' => [ |
|
106 | + 'type' => ['list_of' => 'ID'], |
|
107 | + 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
108 | + ], |
|
109 | + 'ticketId' => [ |
|
110 | + 'type' => 'Int', |
|
111 | + 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
112 | + ], |
|
113 | + 'ticketIdIn' => [ |
|
114 | + 'type' => ['list_of' => 'Int'], |
|
115 | + 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
116 | + ], |
|
117 | + 'priceType' => [ |
|
118 | + 'type' => 'ID', |
|
119 | + 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
120 | + ], |
|
121 | + 'priceTypeIn' => [ |
|
122 | + 'type' => ['list_of' => 'ID'], |
|
123 | + 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
124 | + ], |
|
125 | + 'priceTypeId' => [ |
|
126 | + 'type' => 'Int', |
|
127 | + 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
128 | + ], |
|
129 | + 'priceTypeIdIn' => [ |
|
130 | + 'type' => ['list_of' => 'Int'], |
|
131 | + 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
132 | + ], |
|
133 | + 'priceBaseTypeIn' => [ |
|
134 | + 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
135 | + 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
136 | + ], |
|
137 | + ]; |
|
138 | 138 | |
139 | - $newArgs = apply_filters( |
|
140 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args', |
|
141 | - $newArgs, |
|
142 | - $args |
|
143 | - ); |
|
144 | - return array_merge( |
|
145 | - $newArgs, |
|
146 | - $args |
|
147 | - ); |
|
148 | - } |
|
139 | + $newArgs = apply_filters( |
|
140 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args', |
|
141 | + $newArgs, |
|
142 | + $args |
|
143 | + ); |
|
144 | + return array_merge( |
|
145 | + $newArgs, |
|
146 | + $args |
|
147 | + ); |
|
148 | + } |
|
149 | 149 | } |