@@ -21,61 +21,61 @@ |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * DatetimeConnection constructor. |
|
26 | - * |
|
27 | - * @param EEM_Datetime $model |
|
28 | - */ |
|
29 | - public function __construct(EEM_Datetime $model) |
|
30 | - { |
|
31 | - $this->model = $model; |
|
32 | - } |
|
24 | + /** |
|
25 | + * DatetimeConnection constructor. |
|
26 | + * |
|
27 | + * @param EEM_Datetime $model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Datetime $model) |
|
30 | + { |
|
31 | + $this->model = $model; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * @return array |
|
37 | - * @since $VID:$ |
|
38 | - */ |
|
39 | - public function config() |
|
40 | - { |
|
41 | - return [ |
|
42 | - 'fromType' => $this->namespace . 'Ticket', |
|
43 | - 'toType' => $this->namespace . 'Datetime', |
|
44 | - 'fromFieldName' => 'datetimes', |
|
45 | - 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
|
46 | - 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
47 | - 'resolve' => [$this, 'resolveConnection'], |
|
48 | - 'resolveNode' => [$this, 'resolveNode'], |
|
49 | - ]; |
|
50 | - } |
|
35 | + /** |
|
36 | + * @return array |
|
37 | + * @since $VID:$ |
|
38 | + */ |
|
39 | + public function config() |
|
40 | + { |
|
41 | + return [ |
|
42 | + 'fromType' => $this->namespace . 'Ticket', |
|
43 | + 'toType' => $this->namespace . 'Datetime', |
|
44 | + 'fromFieldName' => 'datetimes', |
|
45 | + 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
|
46 | + 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
47 | + 'resolve' => [$this, 'resolveConnection'], |
|
48 | + 'resolveNode' => [$this, 'resolveNode'], |
|
49 | + ]; |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * @param $entity |
|
55 | - * @param $args |
|
56 | - * @param $context |
|
57 | - * @param $info |
|
58 | - * @return array |
|
59 | - * @throws Exception |
|
60 | - * @since $VID:$ |
|
61 | - */ |
|
62 | - public function resolveConnection($entity, $args, $context, $info) |
|
63 | - { |
|
64 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
65 | - return $resolver->get_connection(); |
|
66 | - } |
|
53 | + /** |
|
54 | + * @param $entity |
|
55 | + * @param $args |
|
56 | + * @param $context |
|
57 | + * @param $info |
|
58 | + * @return array |
|
59 | + * @throws Exception |
|
60 | + * @since $VID:$ |
|
61 | + */ |
|
62 | + public function resolveConnection($entity, $args, $context, $info) |
|
63 | + { |
|
64 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
65 | + return $resolver->get_connection(); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | - /** |
|
70 | - * @param $id |
|
71 | - * @param $args |
|
72 | - * @param $context |
|
73 | - * @param $info |
|
74 | - * @return EE_Base_Class |
|
75 | - * @since $VID:$ |
|
76 | - */ |
|
77 | - public function resolveNode($id, $args, $context, $info) |
|
78 | - { |
|
79 | - return $this->model->get_one_by_ID($id); |
|
80 | - } |
|
69 | + /** |
|
70 | + * @param $id |
|
71 | + * @param $args |
|
72 | + * @param $context |
|
73 | + * @param $info |
|
74 | + * @return EE_Base_Class |
|
75 | + * @since $VID:$ |
|
76 | + */ |
|
77 | + public function resolveNode($id, $args, $context, $info) |
|
78 | + { |
|
79 | + return $this->model->get_one_by_ID($id); |
|
80 | + } |
|
81 | 81 | } |
@@ -39,8 +39,8 @@ |
||
39 | 39 | public function config() |
40 | 40 | { |
41 | 41 | return [ |
42 | - 'fromType' => $this->namespace . 'Ticket', |
|
43 | - 'toType' => $this->namespace . 'Datetime', |
|
42 | + 'fromType' => $this->namespace.'Ticket', |
|
43 | + 'toType' => $this->namespace.'Datetime', |
|
44 | 44 | 'fromFieldName' => 'datetimes', |
45 | 45 | 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
46 | 46 | 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
@@ -21,60 +21,60 @@ |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * DatetimeConnection constructor. |
|
26 | - * |
|
27 | - * @param EEM_Venue $model |
|
28 | - */ |
|
29 | - public function __construct(EEM_Venue $model) |
|
30 | - { |
|
31 | - $this->model = $model; |
|
32 | - } |
|
24 | + /** |
|
25 | + * DatetimeConnection constructor. |
|
26 | + * |
|
27 | + * @param EEM_Venue $model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Venue $model) |
|
30 | + { |
|
31 | + $this->model = $model; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * @return array |
|
37 | - * @since $VID:$ |
|
38 | - */ |
|
39 | - public function config() |
|
40 | - { |
|
41 | - return [ |
|
42 | - 'fromType' => $this->namespace . 'Event', |
|
43 | - 'toType' => $this->namespace . 'Venue', |
|
44 | - 'fromFieldName' => 'venues', |
|
45 | - 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
|
46 | - 'resolve' => [$this, 'resolveConnection'], |
|
47 | - 'resolveNode' => [$this, 'resolveNode'], |
|
48 | - ]; |
|
49 | - } |
|
35 | + /** |
|
36 | + * @return array |
|
37 | + * @since $VID:$ |
|
38 | + */ |
|
39 | + public function config() |
|
40 | + { |
|
41 | + return [ |
|
42 | + 'fromType' => $this->namespace . 'Event', |
|
43 | + 'toType' => $this->namespace . 'Venue', |
|
44 | + 'fromFieldName' => 'venues', |
|
45 | + 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
|
46 | + 'resolve' => [$this, 'resolveConnection'], |
|
47 | + 'resolveNode' => [$this, 'resolveNode'], |
|
48 | + ]; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @param $entity |
|
54 | - * @param $args |
|
55 | - * @param $context |
|
56 | - * @param $info |
|
57 | - * @return array |
|
58 | - * @throws Exception |
|
59 | - * @since $VID:$ |
|
60 | - */ |
|
61 | - public function resolveConnection($entity, $args, $context, $info) |
|
62 | - { |
|
63 | - $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
64 | - return $resolver->get_connection(); |
|
65 | - } |
|
52 | + /** |
|
53 | + * @param $entity |
|
54 | + * @param $args |
|
55 | + * @param $context |
|
56 | + * @param $info |
|
57 | + * @return array |
|
58 | + * @throws Exception |
|
59 | + * @since $VID:$ |
|
60 | + */ |
|
61 | + public function resolveConnection($entity, $args, $context, $info) |
|
62 | + { |
|
63 | + $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
64 | + return $resolver->get_connection(); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * @param $id |
|
70 | - * @param $args |
|
71 | - * @param $context |
|
72 | - * @param $info |
|
73 | - * @return EE_Base_Class |
|
74 | - * @since $VID:$ |
|
75 | - */ |
|
76 | - public function resolveNode($id, $args, $context, $info) |
|
77 | - { |
|
78 | - return DataSource::resolve_post_object($id, $context); |
|
79 | - } |
|
68 | + /** |
|
69 | + * @param $id |
|
70 | + * @param $args |
|
71 | + * @param $context |
|
72 | + * @param $info |
|
73 | + * @return EE_Base_Class |
|
74 | + * @since $VID:$ |
|
75 | + */ |
|
76 | + public function resolveNode($id, $args, $context, $info) |
|
77 | + { |
|
78 | + return DataSource::resolve_post_object($id, $context); |
|
79 | + } |
|
80 | 80 | } |
@@ -39,8 +39,8 @@ |
||
39 | 39 | public function config() |
40 | 40 | { |
41 | 41 | return [ |
42 | - 'fromType' => $this->namespace . 'Event', |
|
43 | - 'toType' => $this->namespace . 'Venue', |
|
42 | + 'fromType' => $this->namespace.'Event', |
|
43 | + 'toType' => $this->namespace.'Venue', |
|
44 | 44 | 'fromFieldName' => 'venues', |
45 | 45 | 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
46 | 46 | 'resolve' => [$this, 'resolveConnection'], |
@@ -20,119 +20,119 @@ |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * TicketConnection constructor. |
|
25 | - * |
|
26 | - * @param EEM_Price $model |
|
27 | - */ |
|
28 | - public function __construct(EEM_Price $model) |
|
29 | - { |
|
30 | - $this->model = $model; |
|
31 | - } |
|
23 | + /** |
|
24 | + * TicketConnection constructor. |
|
25 | + * |
|
26 | + * @param EEM_Price $model |
|
27 | + */ |
|
28 | + public function __construct(EEM_Price $model) |
|
29 | + { |
|
30 | + $this->model = $model; |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * @return array |
|
36 | - * @since $VID:$ |
|
37 | - */ |
|
38 | - public function config() |
|
39 | - { |
|
40 | - return [ |
|
41 | - 'fromType' => $this->namespace . 'Ticket', |
|
42 | - 'toType' => $this->namespace . 'Price', |
|
43 | - 'fromFieldName' => 'prices', |
|
44 | - 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
45 | - 'connectionArgs' => self::get_connection_args(), |
|
46 | - 'resolve' => [$this, 'resolveConnection'], |
|
47 | - 'resolveNode' => [$this, 'resolveNode'] |
|
48 | - ]; |
|
49 | - } |
|
34 | + /** |
|
35 | + * @return array |
|
36 | + * @since $VID:$ |
|
37 | + */ |
|
38 | + public function config() |
|
39 | + { |
|
40 | + return [ |
|
41 | + 'fromType' => $this->namespace . 'Ticket', |
|
42 | + 'toType' => $this->namespace . 'Price', |
|
43 | + 'fromFieldName' => 'prices', |
|
44 | + 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
45 | + 'connectionArgs' => self::get_connection_args(), |
|
46 | + 'resolve' => [$this, 'resolveConnection'], |
|
47 | + 'resolveNode' => [$this, 'resolveNode'] |
|
48 | + ]; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @param $entity |
|
54 | - * @param $args |
|
55 | - * @param $context |
|
56 | - * @param $info |
|
57 | - * @return array |
|
58 | - * @throws Exception |
|
59 | - * @since $VID:$ |
|
60 | - */ |
|
61 | - public function resolveConnection($entity, $args, $context, $info) |
|
62 | - { |
|
63 | - $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
64 | - return $resolver->get_connection(); |
|
65 | - } |
|
52 | + /** |
|
53 | + * @param $entity |
|
54 | + * @param $args |
|
55 | + * @param $context |
|
56 | + * @param $info |
|
57 | + * @return array |
|
58 | + * @throws Exception |
|
59 | + * @since $VID:$ |
|
60 | + */ |
|
61 | + public function resolveConnection($entity, $args, $context, $info) |
|
62 | + { |
|
63 | + $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
64 | + return $resolver->get_connection(); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * @param $id |
|
70 | - * @param $args |
|
71 | - * @param $context |
|
72 | - * @param $info |
|
73 | - * @return EE_Base_Class |
|
74 | - * @since $VID:$ |
|
75 | - */ |
|
76 | - public function resolveNode($id, $args, $context, $info) |
|
77 | - { |
|
78 | - return $this->model->get_one_by_ID($id); |
|
79 | - } |
|
68 | + /** |
|
69 | + * @param $id |
|
70 | + * @param $args |
|
71 | + * @param $context |
|
72 | + * @param $info |
|
73 | + * @return EE_Base_Class |
|
74 | + * @since $VID:$ |
|
75 | + */ |
|
76 | + public function resolveNode($id, $args, $context, $info) |
|
77 | + { |
|
78 | + return $this->model->get_one_by_ID($id); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Given an optional array of args, this returns the args to be used in the connection |
|
83 | - * |
|
84 | - * @access public |
|
85 | - * @param array $args The args to modify the defaults |
|
86 | - * |
|
87 | - * @return array |
|
88 | - */ |
|
89 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
90 | - public static function get_connection_args($args = []) |
|
91 | - { |
|
92 | - return array_merge( |
|
93 | - [ |
|
94 | - 'ticket' => [ |
|
95 | - 'type' => 'ID', |
|
96 | - 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
97 | - ], |
|
98 | - 'ticketIn' => [ |
|
99 | - 'type' => ['list_of' => 'ID'], |
|
100 | - 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
101 | - ], |
|
102 | - 'ticketId' => [ |
|
103 | - 'type' => 'Int', |
|
104 | - 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
105 | - ], |
|
106 | - 'ticketIdIn' => [ |
|
107 | - 'type' => ['list_of' => 'Int'], |
|
108 | - 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
109 | - ], |
|
110 | - 'priceType' => [ |
|
111 | - 'type' => 'ID', |
|
112 | - 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
113 | - ], |
|
114 | - 'priceTypeIn' => [ |
|
115 | - 'type' => ['list_of' => 'ID'], |
|
116 | - 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
117 | - ], |
|
118 | - 'priceTypeId' => [ |
|
119 | - 'type' => 'Int', |
|
120 | - 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
121 | - ], |
|
122 | - 'priceTypeIdIn' => [ |
|
123 | - 'type' => ['list_of' => 'Int'], |
|
124 | - 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
125 | - ], |
|
126 | - 'priceBaseType' => [ |
|
127 | - 'type' => 'PriceBaseTypeEnum', |
|
128 | - 'description' => esc_html__('Price Base type.', 'event_espresso'), |
|
129 | - ], |
|
130 | - 'priceBaseTypeIn' => [ |
|
131 | - 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
132 | - 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
133 | - ], |
|
134 | - ], |
|
135 | - $args |
|
136 | - ); |
|
137 | - } |
|
81 | + /** |
|
82 | + * Given an optional array of args, this returns the args to be used in the connection |
|
83 | + * |
|
84 | + * @access public |
|
85 | + * @param array $args The args to modify the defaults |
|
86 | + * |
|
87 | + * @return array |
|
88 | + */ |
|
89 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
90 | + public static function get_connection_args($args = []) |
|
91 | + { |
|
92 | + return array_merge( |
|
93 | + [ |
|
94 | + 'ticket' => [ |
|
95 | + 'type' => 'ID', |
|
96 | + 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
97 | + ], |
|
98 | + 'ticketIn' => [ |
|
99 | + 'type' => ['list_of' => 'ID'], |
|
100 | + 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
101 | + ], |
|
102 | + 'ticketId' => [ |
|
103 | + 'type' => 'Int', |
|
104 | + 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
105 | + ], |
|
106 | + 'ticketIdIn' => [ |
|
107 | + 'type' => ['list_of' => 'Int'], |
|
108 | + 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
109 | + ], |
|
110 | + 'priceType' => [ |
|
111 | + 'type' => 'ID', |
|
112 | + 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
113 | + ], |
|
114 | + 'priceTypeIn' => [ |
|
115 | + 'type' => ['list_of' => 'ID'], |
|
116 | + 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
117 | + ], |
|
118 | + 'priceTypeId' => [ |
|
119 | + 'type' => 'Int', |
|
120 | + 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
121 | + ], |
|
122 | + 'priceTypeIdIn' => [ |
|
123 | + 'type' => ['list_of' => 'Int'], |
|
124 | + 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
125 | + ], |
|
126 | + 'priceBaseType' => [ |
|
127 | + 'type' => 'PriceBaseTypeEnum', |
|
128 | + 'description' => esc_html__('Price Base type.', 'event_espresso'), |
|
129 | + ], |
|
130 | + 'priceBaseTypeIn' => [ |
|
131 | + 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
132 | + 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
133 | + ], |
|
134 | + ], |
|
135 | + $args |
|
136 | + ); |
|
137 | + } |
|
138 | 138 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | public function config() |
39 | 39 | { |
40 | 40 | return [ |
41 | - 'fromType' => $this->namespace . 'Ticket', |
|
42 | - 'toType' => $this->namespace . 'Price', |
|
41 | + 'fromType' => $this->namespace.'Ticket', |
|
42 | + 'toType' => $this->namespace.'Price', |
|
43 | 43 | 'fromFieldName' => 'prices', |
44 | 44 | 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
45 | 45 | 'connectionArgs' => self::get_connection_args(), |
@@ -19,45 +19,45 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * PriceTypeConnection constructor. |
|
24 | - * |
|
25 | - * @param EEM_Price_Type $model |
|
26 | - */ |
|
27 | - public function __construct(EEM_Price_Type $model) |
|
28 | - { |
|
29 | - $this->model = $model; |
|
30 | - } |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @return array |
|
35 | - * @since $VID:$ |
|
36 | - */ |
|
37 | - public function config() |
|
38 | - { |
|
39 | - return [ |
|
40 | - 'fromType' => 'RootQuery', |
|
41 | - 'toType' => $this->namespace . 'PriceType', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
43 | - 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
|
44 | - 'resolve' => [$this, 'resolveConnection'], |
|
45 | - 'resolveNode' => [$this, 'resolveNode'] |
|
46 | - ]; |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * @param $entity |
|
52 | - * @param $args |
|
53 | - * @param $context |
|
54 | - * @param $info |
|
55 | - * @return PriceTypeConnectionResolver |
|
56 | - * @throws Exception |
|
57 | - * @since $VID:$ |
|
58 | - */ |
|
59 | - public function getConnectionResolver($entity, $args, $context, $info) |
|
60 | - { |
|
61 | - return new PriceTypeConnectionResolver($entity, $args, $context, $info); |
|
62 | - } |
|
22 | + /** |
|
23 | + * PriceTypeConnection constructor. |
|
24 | + * |
|
25 | + * @param EEM_Price_Type $model |
|
26 | + */ |
|
27 | + public function __construct(EEM_Price_Type $model) |
|
28 | + { |
|
29 | + $this->model = $model; |
|
30 | + } |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @return array |
|
35 | + * @since $VID:$ |
|
36 | + */ |
|
37 | + public function config() |
|
38 | + { |
|
39 | + return [ |
|
40 | + 'fromType' => 'RootQuery', |
|
41 | + 'toType' => $this->namespace . 'PriceType', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
43 | + 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
|
44 | + 'resolve' => [$this, 'resolveConnection'], |
|
45 | + 'resolveNode' => [$this, 'resolveNode'] |
|
46 | + ]; |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * @param $entity |
|
52 | + * @param $args |
|
53 | + * @param $context |
|
54 | + * @param $info |
|
55 | + * @return PriceTypeConnectionResolver |
|
56 | + * @throws Exception |
|
57 | + * @since $VID:$ |
|
58 | + */ |
|
59 | + public function getConnectionResolver($entity, $args, $context, $info) |
|
60 | + { |
|
61 | + return new PriceTypeConnectionResolver($entity, $args, $context, $info); |
|
62 | + } |
|
63 | 63 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'PriceType', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
41 | + 'toType' => $this->namespace.'PriceType', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'PriceTypes', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
44 | 44 | 'resolve' => [$this, 'resolveConnection'], |
45 | 45 | 'resolveNode' => [$this, 'resolveNode'] |
@@ -19,46 +19,46 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * TicketConnection constructor. |
|
24 | - * |
|
25 | - * @param EEM_Ticket $model |
|
26 | - */ |
|
27 | - public function __construct(EEM_Ticket $model) |
|
28 | - { |
|
29 | - $this->model = $model; |
|
30 | - } |
|
22 | + /** |
|
23 | + * TicketConnection constructor. |
|
24 | + * |
|
25 | + * @param EEM_Ticket $model |
|
26 | + */ |
|
27 | + public function __construct(EEM_Ticket $model) |
|
28 | + { |
|
29 | + $this->model = $model; |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @return array |
|
35 | - * @since $VID:$ |
|
36 | - */ |
|
37 | - public function config() |
|
38 | - { |
|
39 | - return [ |
|
40 | - 'fromType' => 'RootQuery', |
|
41 | - 'toType' => $this->namespace . 'Ticket', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
43 | - 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
44 | - 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
45 | - 'resolve' => [$this, 'resolveConnection'], |
|
46 | - 'resolveNode' => [$this, 'resolveNode'] |
|
47 | - ]; |
|
48 | - } |
|
33 | + /** |
|
34 | + * @return array |
|
35 | + * @since $VID:$ |
|
36 | + */ |
|
37 | + public function config() |
|
38 | + { |
|
39 | + return [ |
|
40 | + 'fromType' => 'RootQuery', |
|
41 | + 'toType' => $this->namespace . 'Ticket', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
43 | + 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
44 | + 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
45 | + 'resolve' => [$this, 'resolveConnection'], |
|
46 | + 'resolveNode' => [$this, 'resolveNode'] |
|
47 | + ]; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * @param $entity |
|
53 | - * @param $args |
|
54 | - * @param $context |
|
55 | - * @param $info |
|
56 | - * @return TicketConnectionResolver |
|
57 | - * @throws Exception |
|
58 | - * @since $VID:$ |
|
59 | - */ |
|
60 | - public function getConnectionResolver($entity, $args, $context, $info) |
|
61 | - { |
|
62 | - return new TicketConnectionResolver($entity, $args, $context, $info); |
|
63 | - } |
|
51 | + /** |
|
52 | + * @param $entity |
|
53 | + * @param $args |
|
54 | + * @param $context |
|
55 | + * @param $info |
|
56 | + * @return TicketConnectionResolver |
|
57 | + * @throws Exception |
|
58 | + * @since $VID:$ |
|
59 | + */ |
|
60 | + public function getConnectionResolver($entity, $args, $context, $info) |
|
61 | + { |
|
62 | + return new TicketConnectionResolver($entity, $args, $context, $info); |
|
63 | + } |
|
64 | 64 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'Ticket', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
41 | + 'toType' => $this->namespace.'Ticket', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'Tickets', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
44 | 44 | 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -20,44 +20,44 @@ |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * @param $entity |
|
25 | - * @param $args |
|
26 | - * @param $context |
|
27 | - * @param $info |
|
28 | - * @return AbstractConnectionResolver |
|
29 | - * @throws Exception |
|
30 | - * @since $VID:$ |
|
31 | - */ |
|
32 | - abstract public function getConnectionResolver($entity, $args, $context, $info); |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * @param $entity |
|
37 | - * @param $args |
|
38 | - * @param $context |
|
39 | - * @param $info |
|
40 | - * @return array |
|
41 | - * @throws Exception |
|
42 | - * @since $VID:$ |
|
43 | - */ |
|
44 | - public function resolveConnection($entity, $args, $context, $info) |
|
45 | - { |
|
46 | - $resolver = $this->getConnectionResolver($entity, $args, $context, $info); |
|
47 | - return $resolver->get_connection(); |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * @param $id |
|
53 | - * @param $args |
|
54 | - * @param $context |
|
55 | - * @param $info |
|
56 | - * @return EE_Base_Class |
|
57 | - * @since $VID:$ |
|
58 | - */ |
|
59 | - public function resolveNode($id, $args, $context, $info) |
|
60 | - { |
|
61 | - return $this->model->get_one_by_ID($id); |
|
62 | - } |
|
23 | + /** |
|
24 | + * @param $entity |
|
25 | + * @param $args |
|
26 | + * @param $context |
|
27 | + * @param $info |
|
28 | + * @return AbstractConnectionResolver |
|
29 | + * @throws Exception |
|
30 | + * @since $VID:$ |
|
31 | + */ |
|
32 | + abstract public function getConnectionResolver($entity, $args, $context, $info); |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * @param $entity |
|
37 | + * @param $args |
|
38 | + * @param $context |
|
39 | + * @param $info |
|
40 | + * @return array |
|
41 | + * @throws Exception |
|
42 | + * @since $VID:$ |
|
43 | + */ |
|
44 | + public function resolveConnection($entity, $args, $context, $info) |
|
45 | + { |
|
46 | + $resolver = $this->getConnectionResolver($entity, $args, $context, $info); |
|
47 | + return $resolver->get_connection(); |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * @param $id |
|
53 | + * @param $args |
|
54 | + * @param $context |
|
55 | + * @param $info |
|
56 | + * @return EE_Base_Class |
|
57 | + * @since $VID:$ |
|
58 | + */ |
|
59 | + public function resolveNode($id, $args, $context, $info) |
|
60 | + { |
|
61 | + return $this->model->get_one_by_ID($id); |
|
62 | + } |
|
63 | 63 | } |
@@ -25,215 +25,215 @@ |
||
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 | - return [ |
|
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 | - 'name', |
|
64 | - 'String', |
|
65 | - 'name', |
|
66 | - esc_html__('Price Name', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'amount', |
|
70 | - 'Float', |
|
71 | - 'amount', |
|
72 | - esc_html__('Price Amount', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'desc', |
|
76 | - 'String', |
|
77 | - 'desc', |
|
78 | - esc_html__('Price description', 'event_espresso') |
|
79 | - ), |
|
80 | - new GraphQLField( |
|
81 | - 'overrides', |
|
82 | - 'Int', |
|
83 | - 'overrides', |
|
84 | - esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
85 | - ), |
|
86 | - new GraphQLField( |
|
87 | - 'order', |
|
88 | - 'Int', |
|
89 | - 'order', |
|
90 | - esc_html__('Order of Application of Price.', 'event_espresso') |
|
91 | - ), |
|
92 | - new GraphQLOutputField( |
|
93 | - 'parent', |
|
94 | - $this->name(), |
|
95 | - null, |
|
96 | - esc_html__('The parent price of the current price', 'event_espresso') |
|
97 | - ), |
|
98 | - new GraphQLInputField( |
|
99 | - 'parent', |
|
100 | - 'ID', |
|
101 | - null, |
|
102 | - esc_html__('The parent price ID', 'event_espresso') |
|
103 | - ), |
|
104 | - new GraphQLOutputField( |
|
105 | - 'priceType', |
|
106 | - $this->namespace . 'PriceType', |
|
107 | - 'type_obj', |
|
108 | - esc_html__('The related price type object.', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLOutputField( |
|
111 | - 'priceTypeOrder', |
|
112 | - 'Int', |
|
113 | - 'type_order', |
|
114 | - esc_html__('Order of Application of Price type.', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLInputField( |
|
117 | - 'priceType', |
|
118 | - 'ID', |
|
119 | - null, |
|
120 | - esc_html__('The price type ID', 'event_espresso') |
|
121 | - ), |
|
122 | - new GraphQLOutputField( |
|
123 | - 'isDeleted', |
|
124 | - 'Boolean', |
|
125 | - 'deleted', |
|
126 | - esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
127 | - ), |
|
128 | - new GraphQLField( |
|
129 | - 'isDefault', |
|
130 | - 'Boolean', |
|
131 | - 'is_default', |
|
132 | - esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
133 | - ), |
|
134 | - new GraphQLOutputField( |
|
135 | - 'isPercent', |
|
136 | - 'Boolean', |
|
137 | - 'is_percent', |
|
138 | - esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
139 | - ), |
|
140 | - new GraphQLOutputField( |
|
141 | - 'isBasePrice', |
|
142 | - 'Boolean', |
|
143 | - 'is_base_price', |
|
144 | - esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
145 | - ), |
|
146 | - new GraphQLOutputField( |
|
147 | - 'isDiscount', |
|
148 | - 'Boolean', |
|
149 | - 'is_discount', |
|
150 | - esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLOutputField( |
|
153 | - 'isTax', |
|
154 | - 'Boolean', |
|
155 | - 'is_tax', |
|
156 | - esc_html__('Flag indicating price is a tax.', '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 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
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 | + 'name', |
|
64 | + 'String', |
|
65 | + 'name', |
|
66 | + esc_html__('Price Name', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'amount', |
|
70 | + 'Float', |
|
71 | + 'amount', |
|
72 | + esc_html__('Price Amount', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'desc', |
|
76 | + 'String', |
|
77 | + 'desc', |
|
78 | + esc_html__('Price description', 'event_espresso') |
|
79 | + ), |
|
80 | + new GraphQLField( |
|
81 | + 'overrides', |
|
82 | + 'Int', |
|
83 | + 'overrides', |
|
84 | + esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
85 | + ), |
|
86 | + new GraphQLField( |
|
87 | + 'order', |
|
88 | + 'Int', |
|
89 | + 'order', |
|
90 | + esc_html__('Order of Application of Price.', 'event_espresso') |
|
91 | + ), |
|
92 | + new GraphQLOutputField( |
|
93 | + 'parent', |
|
94 | + $this->name(), |
|
95 | + null, |
|
96 | + esc_html__('The parent price of the current price', 'event_espresso') |
|
97 | + ), |
|
98 | + new GraphQLInputField( |
|
99 | + 'parent', |
|
100 | + 'ID', |
|
101 | + null, |
|
102 | + esc_html__('The parent price ID', 'event_espresso') |
|
103 | + ), |
|
104 | + new GraphQLOutputField( |
|
105 | + 'priceType', |
|
106 | + $this->namespace . 'PriceType', |
|
107 | + 'type_obj', |
|
108 | + esc_html__('The related price type object.', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLOutputField( |
|
111 | + 'priceTypeOrder', |
|
112 | + 'Int', |
|
113 | + 'type_order', |
|
114 | + esc_html__('Order of Application of Price type.', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLInputField( |
|
117 | + 'priceType', |
|
118 | + 'ID', |
|
119 | + null, |
|
120 | + esc_html__('The price type ID', 'event_espresso') |
|
121 | + ), |
|
122 | + new GraphQLOutputField( |
|
123 | + 'isDeleted', |
|
124 | + 'Boolean', |
|
125 | + 'deleted', |
|
126 | + esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
127 | + ), |
|
128 | + new GraphQLField( |
|
129 | + 'isDefault', |
|
130 | + 'Boolean', |
|
131 | + 'is_default', |
|
132 | + esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
133 | + ), |
|
134 | + new GraphQLOutputField( |
|
135 | + 'isPercent', |
|
136 | + 'Boolean', |
|
137 | + 'is_percent', |
|
138 | + esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
139 | + ), |
|
140 | + new GraphQLOutputField( |
|
141 | + 'isBasePrice', |
|
142 | + 'Boolean', |
|
143 | + 'is_base_price', |
|
144 | + esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
145 | + ), |
|
146 | + new GraphQLOutputField( |
|
147 | + 'isDiscount', |
|
148 | + 'Boolean', |
|
149 | + 'is_discount', |
|
150 | + esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLOutputField( |
|
153 | + 'isTax', |
|
154 | + 'Boolean', |
|
155 | + 'is_tax', |
|
156 | + esc_html__('Flag indicating price is a tax.', '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 | + } |
|
172 | 172 | |
173 | 173 | |
174 | - /** |
|
175 | - * @param array $inputFields The mutation input fields. |
|
176 | - * @throws InvalidArgumentException |
|
177 | - * @throws ReflectionException |
|
178 | - * @since $VID:$ |
|
179 | - */ |
|
180 | - public function registerMutations(array $inputFields) |
|
181 | - { |
|
182 | - // Register mutation to update an entity. |
|
183 | - register_graphql_mutation( |
|
184 | - 'update' . $this->name(), |
|
185 | - [ |
|
186 | - 'inputFields' => $inputFields, |
|
187 | - 'outputFields' => [ |
|
188 | - lcfirst($this->name()) => [ |
|
189 | - 'type' => $this->name(), |
|
190 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
191 | - ], |
|
192 | - ], |
|
193 | - 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
194 | - ] |
|
195 | - ); |
|
196 | - // Register mutation to delete an entity. |
|
197 | - register_graphql_mutation( |
|
198 | - 'delete' . $this->name(), |
|
199 | - [ |
|
200 | - 'inputFields' => [ |
|
201 | - 'id' => $inputFields['id'], |
|
202 | - 'deletePermanently' => [ |
|
203 | - 'type' => 'Boolean', |
|
204 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
205 | - ], |
|
206 | - ], |
|
207 | - 'outputFields' => [ |
|
208 | - lcfirst($this->name()) => [ |
|
209 | - 'type' => $this->name(), |
|
210 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
211 | - 'resolve' => static function ($payload) { |
|
212 | - $deleted = (object) $payload['deleted']; |
|
174 | + /** |
|
175 | + * @param array $inputFields The mutation input fields. |
|
176 | + * @throws InvalidArgumentException |
|
177 | + * @throws ReflectionException |
|
178 | + * @since $VID:$ |
|
179 | + */ |
|
180 | + public function registerMutations(array $inputFields) |
|
181 | + { |
|
182 | + // Register mutation to update an entity. |
|
183 | + register_graphql_mutation( |
|
184 | + 'update' . $this->name(), |
|
185 | + [ |
|
186 | + 'inputFields' => $inputFields, |
|
187 | + 'outputFields' => [ |
|
188 | + lcfirst($this->name()) => [ |
|
189 | + 'type' => $this->name(), |
|
190 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
191 | + ], |
|
192 | + ], |
|
193 | + 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
194 | + ] |
|
195 | + ); |
|
196 | + // Register mutation to delete an entity. |
|
197 | + register_graphql_mutation( |
|
198 | + 'delete' . $this->name(), |
|
199 | + [ |
|
200 | + 'inputFields' => [ |
|
201 | + 'id' => $inputFields['id'], |
|
202 | + 'deletePermanently' => [ |
|
203 | + 'type' => 'Boolean', |
|
204 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
205 | + ], |
|
206 | + ], |
|
207 | + 'outputFields' => [ |
|
208 | + lcfirst($this->name()) => [ |
|
209 | + 'type' => $this->name(), |
|
210 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
211 | + 'resolve' => static function ($payload) { |
|
212 | + $deleted = (object) $payload['deleted']; |
|
213 | 213 | |
214 | - return ! empty($deleted) ? $deleted : null; |
|
215 | - }, |
|
216 | - ], |
|
217 | - ], |
|
218 | - 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
219 | - ] |
|
220 | - ); |
|
214 | + return ! empty($deleted) ? $deleted : null; |
|
215 | + }, |
|
216 | + ], |
|
217 | + ], |
|
218 | + 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
219 | + ] |
|
220 | + ); |
|
221 | 221 | |
222 | - // remove primary key from input. |
|
223 | - unset($inputFields['id']); |
|
224 | - // Register mutation to update an entity. |
|
225 | - register_graphql_mutation( |
|
226 | - 'create' . $this->name(), |
|
227 | - [ |
|
228 | - 'inputFields' => $inputFields, |
|
229 | - 'outputFields' => [ |
|
230 | - lcfirst($this->name()) => [ |
|
231 | - 'type' => $this->name(), |
|
232 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
233 | - ], |
|
234 | - ], |
|
235 | - 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
236 | - ] |
|
237 | - ); |
|
238 | - } |
|
222 | + // remove primary key from input. |
|
223 | + unset($inputFields['id']); |
|
224 | + // Register mutation to update an entity. |
|
225 | + register_graphql_mutation( |
|
226 | + 'create' . $this->name(), |
|
227 | + [ |
|
228 | + 'inputFields' => $inputFields, |
|
229 | + 'outputFields' => [ |
|
230 | + lcfirst($this->name()) => [ |
|
231 | + 'type' => $this->name(), |
|
232 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
233 | + ], |
|
234 | + ], |
|
235 | + 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
236 | + ] |
|
237 | + ); |
|
238 | + } |
|
239 | 239 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function __construct(EEM_Price $price_model) |
34 | 34 | { |
35 | 35 | $this->model = $price_model; |
36 | - $this->setName($this->namespace . 'Price'); |
|
36 | + $this->setName($this->namespace.'Price'); |
|
37 | 37 | $this->setDescription(__('A price.', 'event_espresso')); |
38 | 38 | $this->setIsCustomPostType(false); |
39 | 39 | parent::__construct(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ), |
104 | 104 | new GraphQLOutputField( |
105 | 105 | 'priceType', |
106 | - $this->namespace . 'PriceType', |
|
106 | + $this->namespace.'PriceType', |
|
107 | 107 | 'type_obj', |
108 | 108 | esc_html__('The related price type object.', 'event_espresso') |
109 | 109 | ), |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | // Register mutation to update an entity. |
183 | 183 | register_graphql_mutation( |
184 | - 'update' . $this->name(), |
|
184 | + 'update'.$this->name(), |
|
185 | 185 | [ |
186 | 186 | 'inputFields' => $inputFields, |
187 | 187 | 'outputFields' => [ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ); |
196 | 196 | // Register mutation to delete an entity. |
197 | 197 | register_graphql_mutation( |
198 | - 'delete' . $this->name(), |
|
198 | + 'delete'.$this->name(), |
|
199 | 199 | [ |
200 | 200 | 'inputFields' => [ |
201 | 201 | 'id' => $inputFields['id'], |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | lcfirst($this->name()) => [ |
209 | 209 | 'type' => $this->name(), |
210 | 210 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
211 | - 'resolve' => static function ($payload) { |
|
211 | + 'resolve' => static function($payload) { |
|
212 | 212 | $deleted = (object) $payload['deleted']; |
213 | 213 | |
214 | 214 | return ! empty($deleted) ? $deleted : null; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | unset($inputFields['id']); |
224 | 224 | // Register mutation to update an entity. |
225 | 225 | register_graphql_mutation( |
226 | - 'create' . $this->name(), |
|
226 | + 'create'.$this->name(), |
|
227 | 227 | [ |
228 | 228 | 'inputFields' => $inputFields, |
229 | 229 | 'outputFields' => [ |
@@ -25,285 +25,285 @@ |
||
25 | 25 | class Ticket extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Ticket constructor. |
|
30 | - * |
|
31 | - * @param EEM_Ticket $ticket_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Ticket $ticket_model) |
|
34 | - { |
|
35 | - $this->model = $ticket_model; |
|
36 | - $this->setName($this->namespace . 'Ticket'); |
|
37 | - $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
28 | + /** |
|
29 | + * Ticket constructor. |
|
30 | + * |
|
31 | + * @param EEM_Ticket $ticket_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Ticket $ticket_model) |
|
34 | + { |
|
35 | + $this->model = $ticket_model; |
|
36 | + $this->setName($this->namespace . 'Ticket'); |
|
37 | + $this->setDescription(__('A ticket for an event date', '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 | - return [ |
|
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__('Ticket ID', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'name', |
|
64 | - 'String', |
|
65 | - 'name', |
|
66 | - esc_html__('Ticket Name', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'description', |
|
70 | - 'String', |
|
71 | - 'description', |
|
72 | - esc_html__('Description of Ticket', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'startDate', |
|
76 | - 'String', |
|
77 | - 'start_date', |
|
78 | - esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
79 | - [$this, 'formatDatetime'] |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'endDate', |
|
83 | - 'String', |
|
84 | - 'end_date', |
|
85 | - esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
86 | - [$this, 'formatDatetime'] |
|
87 | - ), |
|
88 | - new GraphQLField( |
|
89 | - 'min', |
|
90 | - 'Int', |
|
91 | - 'min', |
|
92 | - esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
93 | - ), |
|
94 | - new GraphQLField( |
|
95 | - 'max', |
|
96 | - 'Int', |
|
97 | - 'max', |
|
98 | - esc_html__( |
|
99 | - 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
100 | - 'event_espresso' |
|
101 | - ), |
|
102 | - [$this, 'parseInfiniteValue'] |
|
103 | - ), |
|
104 | - new GraphQLField( |
|
105 | - 'price', |
|
106 | - 'Float', |
|
107 | - 'price', |
|
108 | - esc_html__('Final calculated price for ticket', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLField( |
|
111 | - 'sold', |
|
112 | - 'Int', |
|
113 | - 'sold', |
|
114 | - esc_html__('Number of this ticket sold', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLField( |
|
117 | - 'quantity', |
|
118 | - 'Int', |
|
119 | - 'qty', |
|
120 | - esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
121 | - [$this, 'parseInfiniteValue'] |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'reserved', |
|
125 | - 'Int', |
|
126 | - 'reserved', |
|
127 | - esc_html__( |
|
128 | - 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
129 | - 'event_espresso' |
|
130 | - ) |
|
131 | - ), |
|
132 | - new GraphQLField( |
|
133 | - 'uses', |
|
134 | - 'Int', |
|
135 | - 'uses', |
|
136 | - esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
137 | - [$this, 'parseInfiniteValue'] |
|
138 | - ), |
|
139 | - new GraphQLField( |
|
140 | - 'isRequired', |
|
141 | - 'Boolean', |
|
142 | - 'required', |
|
143 | - esc_html__( |
|
144 | - 'Flag indicating whether this ticket must be purchased with a transaction', |
|
145 | - 'event_espresso' |
|
146 | - ) |
|
147 | - ), |
|
148 | - new GraphQLField( |
|
149 | - 'isTaxable', |
|
150 | - 'Boolean', |
|
151 | - 'taxable', |
|
152 | - esc_html__( |
|
153 | - 'Flag indicating whether there is tax applied on this ticket', |
|
154 | - 'event_espresso' |
|
155 | - ) |
|
156 | - ), |
|
157 | - new GraphQLField( |
|
158 | - 'isDefault', |
|
159 | - 'Boolean', |
|
160 | - 'is_default', |
|
161 | - esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
162 | - ), |
|
163 | - new GraphQLField( |
|
164 | - 'order', |
|
165 | - 'Int', |
|
166 | - 'order', |
|
167 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
168 | - ), |
|
169 | - new GraphQLField( |
|
170 | - 'row', |
|
171 | - 'Int', |
|
172 | - 'row', |
|
173 | - esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
174 | - ), |
|
175 | - new GraphQLOutputField( |
|
176 | - 'wpUser', |
|
177 | - 'User', |
|
178 | - null, |
|
179 | - esc_html__('Ticket Creator', 'event_espresso') |
|
180 | - ), |
|
181 | - new GraphQLInputField( |
|
182 | - 'wpUser', |
|
183 | - 'Int', |
|
184 | - null, |
|
185 | - esc_html__('Ticket Creator ID', 'event_espresso') |
|
186 | - ), |
|
187 | - new GraphQLOutputField( |
|
188 | - 'parent', |
|
189 | - $this->name(), |
|
190 | - null, |
|
191 | - esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
192 | - ), |
|
193 | - new GraphQLInputField( |
|
194 | - 'parent', |
|
195 | - 'ID', |
|
196 | - null, |
|
197 | - esc_html__('The parent ticket ID', 'event_espresso') |
|
198 | - ), |
|
199 | - new GraphQLField( |
|
200 | - 'reverseCalculate', |
|
201 | - 'Boolean', |
|
202 | - 'reverse_calculate', |
|
203 | - esc_html__( |
|
204 | - 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
205 | - 'event_espresso' |
|
206 | - ) |
|
207 | - ), |
|
208 | - new GraphQLField( |
|
209 | - 'isFree', |
|
210 | - 'Boolean', |
|
211 | - 'is_free', |
|
212 | - esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
213 | - ), |
|
214 | - new GraphQLOutputField( |
|
215 | - 'event', |
|
216 | - $this->namespace . 'Event', |
|
217 | - null, |
|
218 | - esc_html__('Event of the ticket.', 'event_espresso') |
|
219 | - ), |
|
220 | - new GraphQLInputField( |
|
221 | - 'datetimes', |
|
222 | - ['list_of' => 'ID'], |
|
223 | - null, |
|
224 | - sprintf( |
|
225 | - '%1$s %2$s', |
|
226 | - esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
227 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
228 | - ) |
|
229 | - ), |
|
230 | - new GraphQLInputField( |
|
231 | - 'prices', |
|
232 | - ['list_of' => 'ID'], |
|
233 | - null, |
|
234 | - sprintf( |
|
235 | - '%1$s %2$s', |
|
236 | - esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
237 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
238 | - ) |
|
239 | - ), |
|
240 | - ]; |
|
241 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
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__('Ticket ID', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'name', |
|
64 | + 'String', |
|
65 | + 'name', |
|
66 | + esc_html__('Ticket Name', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'description', |
|
70 | + 'String', |
|
71 | + 'description', |
|
72 | + esc_html__('Description of Ticket', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'startDate', |
|
76 | + 'String', |
|
77 | + 'start_date', |
|
78 | + esc_html__('Start date and time of the Ticket', 'event_espresso'), |
|
79 | + [$this, 'formatDatetime'] |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'endDate', |
|
83 | + 'String', |
|
84 | + 'end_date', |
|
85 | + esc_html__('End date and time of the Ticket', 'event_espresso'), |
|
86 | + [$this, 'formatDatetime'] |
|
87 | + ), |
|
88 | + new GraphQLField( |
|
89 | + 'min', |
|
90 | + 'Int', |
|
91 | + 'min', |
|
92 | + esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
93 | + ), |
|
94 | + new GraphQLField( |
|
95 | + 'max', |
|
96 | + 'Int', |
|
97 | + 'max', |
|
98 | + esc_html__( |
|
99 | + 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
100 | + 'event_espresso' |
|
101 | + ), |
|
102 | + [$this, 'parseInfiniteValue'] |
|
103 | + ), |
|
104 | + new GraphQLField( |
|
105 | + 'price', |
|
106 | + 'Float', |
|
107 | + 'price', |
|
108 | + esc_html__('Final calculated price for ticket', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLField( |
|
111 | + 'sold', |
|
112 | + 'Int', |
|
113 | + 'sold', |
|
114 | + esc_html__('Number of this ticket sold', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLField( |
|
117 | + 'quantity', |
|
118 | + 'Int', |
|
119 | + 'qty', |
|
120 | + esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
121 | + [$this, 'parseInfiniteValue'] |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'reserved', |
|
125 | + 'Int', |
|
126 | + 'reserved', |
|
127 | + esc_html__( |
|
128 | + 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
129 | + 'event_espresso' |
|
130 | + ) |
|
131 | + ), |
|
132 | + new GraphQLField( |
|
133 | + 'uses', |
|
134 | + 'Int', |
|
135 | + 'uses', |
|
136 | + esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
137 | + [$this, 'parseInfiniteValue'] |
|
138 | + ), |
|
139 | + new GraphQLField( |
|
140 | + 'isRequired', |
|
141 | + 'Boolean', |
|
142 | + 'required', |
|
143 | + esc_html__( |
|
144 | + 'Flag indicating whether this ticket must be purchased with a transaction', |
|
145 | + 'event_espresso' |
|
146 | + ) |
|
147 | + ), |
|
148 | + new GraphQLField( |
|
149 | + 'isTaxable', |
|
150 | + 'Boolean', |
|
151 | + 'taxable', |
|
152 | + esc_html__( |
|
153 | + 'Flag indicating whether there is tax applied on this ticket', |
|
154 | + 'event_espresso' |
|
155 | + ) |
|
156 | + ), |
|
157 | + new GraphQLField( |
|
158 | + 'isDefault', |
|
159 | + 'Boolean', |
|
160 | + 'is_default', |
|
161 | + esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
162 | + ), |
|
163 | + new GraphQLField( |
|
164 | + 'order', |
|
165 | + 'Int', |
|
166 | + 'order', |
|
167 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
168 | + ), |
|
169 | + new GraphQLField( |
|
170 | + 'row', |
|
171 | + 'Int', |
|
172 | + 'row', |
|
173 | + esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
174 | + ), |
|
175 | + new GraphQLOutputField( |
|
176 | + 'wpUser', |
|
177 | + 'User', |
|
178 | + null, |
|
179 | + esc_html__('Ticket Creator', 'event_espresso') |
|
180 | + ), |
|
181 | + new GraphQLInputField( |
|
182 | + 'wpUser', |
|
183 | + 'Int', |
|
184 | + null, |
|
185 | + esc_html__('Ticket Creator ID', 'event_espresso') |
|
186 | + ), |
|
187 | + new GraphQLOutputField( |
|
188 | + 'parent', |
|
189 | + $this->name(), |
|
190 | + null, |
|
191 | + esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
192 | + ), |
|
193 | + new GraphQLInputField( |
|
194 | + 'parent', |
|
195 | + 'ID', |
|
196 | + null, |
|
197 | + esc_html__('The parent ticket ID', 'event_espresso') |
|
198 | + ), |
|
199 | + new GraphQLField( |
|
200 | + 'reverseCalculate', |
|
201 | + 'Boolean', |
|
202 | + 'reverse_calculate', |
|
203 | + esc_html__( |
|
204 | + 'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
205 | + 'event_espresso' |
|
206 | + ) |
|
207 | + ), |
|
208 | + new GraphQLField( |
|
209 | + 'isFree', |
|
210 | + 'Boolean', |
|
211 | + 'is_free', |
|
212 | + esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
213 | + ), |
|
214 | + new GraphQLOutputField( |
|
215 | + 'event', |
|
216 | + $this->namespace . 'Event', |
|
217 | + null, |
|
218 | + esc_html__('Event of the ticket.', 'event_espresso') |
|
219 | + ), |
|
220 | + new GraphQLInputField( |
|
221 | + 'datetimes', |
|
222 | + ['list_of' => 'ID'], |
|
223 | + null, |
|
224 | + sprintf( |
|
225 | + '%1$s %2$s', |
|
226 | + esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'), |
|
227 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
228 | + ) |
|
229 | + ), |
|
230 | + new GraphQLInputField( |
|
231 | + 'prices', |
|
232 | + ['list_of' => 'ID'], |
|
233 | + null, |
|
234 | + sprintf( |
|
235 | + '%1$s %2$s', |
|
236 | + esc_html__('Globally unique IDs of the prices related to the ticket.', 'event_espresso'), |
|
237 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
238 | + ) |
|
239 | + ), |
|
240 | + ]; |
|
241 | + } |
|
242 | 242 | |
243 | 243 | |
244 | - /** |
|
245 | - * @param array $inputFields The mutation input fields. |
|
246 | - * @throws InvalidArgumentException |
|
247 | - * @throws ReflectionException |
|
248 | - * @since $VID:$ |
|
249 | - */ |
|
250 | - public function registerMutations(array $inputFields) |
|
251 | - { |
|
252 | - // Register mutation to update an entity. |
|
253 | - register_graphql_mutation( |
|
254 | - 'update' . $this->name(), |
|
255 | - [ |
|
256 | - 'inputFields' => $inputFields, |
|
257 | - 'outputFields' => [ |
|
258 | - lcfirst($this->name()) => [ |
|
259 | - 'type' => $this->name(), |
|
260 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
261 | - ], |
|
262 | - ], |
|
263 | - 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
264 | - ] |
|
265 | - ); |
|
266 | - // Register mutation to delete an entity. |
|
267 | - register_graphql_mutation( |
|
268 | - 'delete' . $this->name(), |
|
269 | - [ |
|
270 | - 'inputFields' => [ |
|
271 | - 'id' => $inputFields['id'], |
|
272 | - 'deletePermanently' => [ |
|
273 | - 'type' => 'Boolean', |
|
274 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
275 | - ], |
|
276 | - ], |
|
277 | - 'outputFields' => [ |
|
278 | - lcfirst($this->name()) => [ |
|
279 | - 'type' => $this->name(), |
|
280 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
281 | - 'resolve' => static function ($payload) { |
|
282 | - $deleted = (object) $payload['deleted']; |
|
244 | + /** |
|
245 | + * @param array $inputFields The mutation input fields. |
|
246 | + * @throws InvalidArgumentException |
|
247 | + * @throws ReflectionException |
|
248 | + * @since $VID:$ |
|
249 | + */ |
|
250 | + public function registerMutations(array $inputFields) |
|
251 | + { |
|
252 | + // Register mutation to update an entity. |
|
253 | + register_graphql_mutation( |
|
254 | + 'update' . $this->name(), |
|
255 | + [ |
|
256 | + 'inputFields' => $inputFields, |
|
257 | + 'outputFields' => [ |
|
258 | + lcfirst($this->name()) => [ |
|
259 | + 'type' => $this->name(), |
|
260 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
261 | + ], |
|
262 | + ], |
|
263 | + 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
|
264 | + ] |
|
265 | + ); |
|
266 | + // Register mutation to delete an entity. |
|
267 | + register_graphql_mutation( |
|
268 | + 'delete' . $this->name(), |
|
269 | + [ |
|
270 | + 'inputFields' => [ |
|
271 | + 'id' => $inputFields['id'], |
|
272 | + 'deletePermanently' => [ |
|
273 | + 'type' => 'Boolean', |
|
274 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
275 | + ], |
|
276 | + ], |
|
277 | + 'outputFields' => [ |
|
278 | + lcfirst($this->name()) => [ |
|
279 | + 'type' => $this->name(), |
|
280 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
281 | + 'resolve' => static function ($payload) { |
|
282 | + $deleted = (object) $payload['deleted']; |
|
283 | 283 | |
284 | - return ! empty($deleted) ? $deleted : null; |
|
285 | - }, |
|
286 | - ], |
|
287 | - ], |
|
288 | - 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
289 | - ] |
|
290 | - ); |
|
284 | + return ! empty($deleted) ? $deleted : null; |
|
285 | + }, |
|
286 | + ], |
|
287 | + ], |
|
288 | + 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
|
289 | + ] |
|
290 | + ); |
|
291 | 291 | |
292 | - // remove primary key from input. |
|
293 | - unset($inputFields['id']); |
|
294 | - // Register mutation to update an entity. |
|
295 | - register_graphql_mutation( |
|
296 | - 'create' . $this->name(), |
|
297 | - [ |
|
298 | - 'inputFields' => $inputFields, |
|
299 | - 'outputFields' => [ |
|
300 | - lcfirst($this->name()) => [ |
|
301 | - 'type' => $this->name(), |
|
302 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
303 | - ], |
|
304 | - ], |
|
305 | - 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
306 | - ] |
|
307 | - ); |
|
308 | - } |
|
292 | + // remove primary key from input. |
|
293 | + unset($inputFields['id']); |
|
294 | + // Register mutation to update an entity. |
|
295 | + register_graphql_mutation( |
|
296 | + 'create' . $this->name(), |
|
297 | + [ |
|
298 | + 'inputFields' => $inputFields, |
|
299 | + 'outputFields' => [ |
|
300 | + lcfirst($this->name()) => [ |
|
301 | + 'type' => $this->name(), |
|
302 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
303 | + ], |
|
304 | + ], |
|
305 | + 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
|
306 | + ] |
|
307 | + ); |
|
308 | + } |
|
309 | 309 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function __construct(EEM_Ticket $ticket_model) |
34 | 34 | { |
35 | 35 | $this->model = $ticket_model; |
36 | - $this->setName($this->namespace . 'Ticket'); |
|
36 | + $this->setName($this->namespace.'Ticket'); |
|
37 | 37 | $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
38 | 38 | $this->setIsCustomPostType(false); |
39 | 39 | parent::__construct(); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | ), |
214 | 214 | new GraphQLOutputField( |
215 | 215 | 'event', |
216 | - $this->namespace . 'Event', |
|
216 | + $this->namespace.'Event', |
|
217 | 217 | null, |
218 | 218 | esc_html__('Event of the ticket.', 'event_espresso') |
219 | 219 | ), |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | { |
252 | 252 | // Register mutation to update an entity. |
253 | 253 | register_graphql_mutation( |
254 | - 'update' . $this->name(), |
|
254 | + 'update'.$this->name(), |
|
255 | 255 | [ |
256 | 256 | 'inputFields' => $inputFields, |
257 | 257 | 'outputFields' => [ |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ); |
266 | 266 | // Register mutation to delete an entity. |
267 | 267 | register_graphql_mutation( |
268 | - 'delete' . $this->name(), |
|
268 | + 'delete'.$this->name(), |
|
269 | 269 | [ |
270 | 270 | 'inputFields' => [ |
271 | 271 | 'id' => $inputFields['id'], |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | lcfirst($this->name()) => [ |
279 | 279 | 'type' => $this->name(), |
280 | 280 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
281 | - 'resolve' => static function ($payload) { |
|
281 | + 'resolve' => static function($payload) { |
|
282 | 282 | $deleted = (object) $payload['deleted']; |
283 | 283 | |
284 | 284 | return ! empty($deleted) ? $deleted : null; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | unset($inputFields['id']); |
294 | 294 | // Register mutation to update an entity. |
295 | 295 | register_graphql_mutation( |
296 | - 'create' . $this->name(), |
|
296 | + 'create'.$this->name(), |
|
297 | 297 | [ |
298 | 298 | 'inputFields' => $inputFields, |
299 | 299 | 'outputFields' => [ |
@@ -21,188 +21,188 @@ |
||
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 | - return [ |
|
45 | - new GraphQLOutputField( |
|
46 | - 'dbId', |
|
47 | - ['non_null' => 'Int'], |
|
48 | - 'ID', |
|
49 | - esc_html__('The venue ID.', 'event_espresso') |
|
50 | - ), |
|
51 | - new GraphQLField( |
|
52 | - 'name', |
|
53 | - 'String', |
|
54 | - 'name', |
|
55 | - esc_html__('Venue Name', 'event_espresso') |
|
56 | - ), |
|
57 | - new GraphQLField( |
|
58 | - 'desc', |
|
59 | - 'String', |
|
60 | - 'description', |
|
61 | - esc_html__('Venue Description', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'shortDesc', |
|
65 | - 'String', |
|
66 | - 'excerpt', |
|
67 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLField( |
|
70 | - 'identifier', |
|
71 | - 'String', |
|
72 | - 'identifier', |
|
73 | - esc_html__('Venue Identifier', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLField( |
|
76 | - 'created', |
|
77 | - 'String', |
|
78 | - 'created', |
|
79 | - esc_html__('Date Venue Created', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'order', |
|
83 | - 'Int', |
|
84 | - 'order', |
|
85 | - esc_html__('Venue order', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLOutputField( |
|
88 | - 'wpUser', |
|
89 | - 'User', |
|
90 | - null, |
|
91 | - esc_html__('Venue Creator', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLInputField( |
|
94 | - 'wpUser', |
|
95 | - 'Int', |
|
96 | - null, |
|
97 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLField( |
|
100 | - 'address', |
|
101 | - 'String', |
|
102 | - 'address', |
|
103 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'address2', |
|
107 | - 'String', |
|
108 | - 'address2', |
|
109 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'city', |
|
113 | - 'String', |
|
114 | - 'city', |
|
115 | - esc_html__('Venue City', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLOutputField( |
|
118 | - 'state', |
|
119 | - $this->namespace . 'State', |
|
120 | - null, |
|
121 | - esc_html__('Venue state', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLInputField( |
|
124 | - 'state', |
|
125 | - 'Int', |
|
126 | - null, |
|
127 | - esc_html__('State ID', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLOutputField( |
|
130 | - 'country', |
|
131 | - $this->namespace . 'Country', |
|
132 | - null, |
|
133 | - esc_html__('Venue country', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLInputField( |
|
136 | - 'country', |
|
137 | - 'String', |
|
138 | - null, |
|
139 | - esc_html__('Country ISO Code', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLField( |
|
142 | - 'zip', |
|
143 | - 'String', |
|
144 | - 'zip', |
|
145 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'capacity', |
|
149 | - 'Int', |
|
150 | - 'capacity', |
|
151 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
152 | - [$this, 'parseInfiniteValue'] |
|
153 | - ), |
|
154 | - new GraphQLField( |
|
155 | - 'phone', |
|
156 | - 'String', |
|
157 | - 'phone', |
|
158 | - esc_html__('Venue Phone', 'event_espresso') |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'virtualPhone', |
|
162 | - 'String', |
|
163 | - 'virtual_phone', |
|
164 | - esc_html__('Call in Number', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'url', |
|
168 | - 'String', |
|
169 | - 'venue_url', |
|
170 | - esc_html__('Venue Website', 'event_espresso') |
|
171 | - ), |
|
172 | - new GraphQLField( |
|
173 | - 'virtualUrl', |
|
174 | - 'String', |
|
175 | - 'virtual_url', |
|
176 | - esc_html__('Virtual URL', 'event_espresso') |
|
177 | - ), |
|
178 | - new GraphQLField( |
|
179 | - 'googleMapLink', |
|
180 | - 'String', |
|
181 | - 'google_map_link', |
|
182 | - esc_html__('Google Map Link', 'event_espresso') |
|
183 | - ), |
|
184 | - new GraphQLField( |
|
185 | - 'enableForGmap', |
|
186 | - 'String', |
|
187 | - 'enable_for_gmap', |
|
188 | - esc_html__('Show Google Map?', 'event_espresso') |
|
189 | - ), |
|
190 | - ]; |
|
191 | - } |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + public function getFields() |
|
43 | + { |
|
44 | + return [ |
|
45 | + new GraphQLOutputField( |
|
46 | + 'dbId', |
|
47 | + ['non_null' => 'Int'], |
|
48 | + 'ID', |
|
49 | + esc_html__('The venue ID.', 'event_espresso') |
|
50 | + ), |
|
51 | + new GraphQLField( |
|
52 | + 'name', |
|
53 | + 'String', |
|
54 | + 'name', |
|
55 | + esc_html__('Venue Name', 'event_espresso') |
|
56 | + ), |
|
57 | + new GraphQLField( |
|
58 | + 'desc', |
|
59 | + 'String', |
|
60 | + 'description', |
|
61 | + esc_html__('Venue Description', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'shortDesc', |
|
65 | + 'String', |
|
66 | + 'excerpt', |
|
67 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLField( |
|
70 | + 'identifier', |
|
71 | + 'String', |
|
72 | + 'identifier', |
|
73 | + esc_html__('Venue Identifier', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLField( |
|
76 | + 'created', |
|
77 | + 'String', |
|
78 | + 'created', |
|
79 | + esc_html__('Date Venue Created', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'order', |
|
83 | + 'Int', |
|
84 | + 'order', |
|
85 | + esc_html__('Venue order', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLOutputField( |
|
88 | + 'wpUser', |
|
89 | + 'User', |
|
90 | + null, |
|
91 | + esc_html__('Venue Creator', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLInputField( |
|
94 | + 'wpUser', |
|
95 | + 'Int', |
|
96 | + null, |
|
97 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLField( |
|
100 | + 'address', |
|
101 | + 'String', |
|
102 | + 'address', |
|
103 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'address2', |
|
107 | + 'String', |
|
108 | + 'address2', |
|
109 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'city', |
|
113 | + 'String', |
|
114 | + 'city', |
|
115 | + esc_html__('Venue City', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLOutputField( |
|
118 | + 'state', |
|
119 | + $this->namespace . 'State', |
|
120 | + null, |
|
121 | + esc_html__('Venue state', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLInputField( |
|
124 | + 'state', |
|
125 | + 'Int', |
|
126 | + null, |
|
127 | + esc_html__('State ID', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLOutputField( |
|
130 | + 'country', |
|
131 | + $this->namespace . 'Country', |
|
132 | + null, |
|
133 | + esc_html__('Venue country', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLInputField( |
|
136 | + 'country', |
|
137 | + 'String', |
|
138 | + null, |
|
139 | + esc_html__('Country ISO Code', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLField( |
|
142 | + 'zip', |
|
143 | + 'String', |
|
144 | + 'zip', |
|
145 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'capacity', |
|
149 | + 'Int', |
|
150 | + 'capacity', |
|
151 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
152 | + [$this, 'parseInfiniteValue'] |
|
153 | + ), |
|
154 | + new GraphQLField( |
|
155 | + 'phone', |
|
156 | + 'String', |
|
157 | + 'phone', |
|
158 | + esc_html__('Venue Phone', 'event_espresso') |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'virtualPhone', |
|
162 | + 'String', |
|
163 | + 'virtual_phone', |
|
164 | + esc_html__('Call in Number', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'url', |
|
168 | + 'String', |
|
169 | + 'venue_url', |
|
170 | + esc_html__('Venue Website', 'event_espresso') |
|
171 | + ), |
|
172 | + new GraphQLField( |
|
173 | + 'virtualUrl', |
|
174 | + 'String', |
|
175 | + 'virtual_url', |
|
176 | + esc_html__('Virtual URL', 'event_espresso') |
|
177 | + ), |
|
178 | + new GraphQLField( |
|
179 | + 'googleMapLink', |
|
180 | + 'String', |
|
181 | + 'google_map_link', |
|
182 | + esc_html__('Google Map Link', 'event_espresso') |
|
183 | + ), |
|
184 | + new GraphQLField( |
|
185 | + 'enableForGmap', |
|
186 | + 'String', |
|
187 | + 'enable_for_gmap', |
|
188 | + esc_html__('Show Google Map?', 'event_espresso') |
|
189 | + ), |
|
190 | + ]; |
|
191 | + } |
|
192 | 192 | |
193 | 193 | |
194 | - /** |
|
195 | - * Extends the existing WP GraphQL mutations. |
|
196 | - * |
|
197 | - * @since $VID:$ |
|
198 | - */ |
|
199 | - public function extendMutations() |
|
200 | - { |
|
201 | - add_action( |
|
202 | - 'graphql_post_object_mutation_update_additional_data', |
|
203 | - VenueUpdate::mutateFields($this->model, $this), |
|
204 | - 10, |
|
205 | - 6 |
|
206 | - ); |
|
207 | - } |
|
194 | + /** |
|
195 | + * Extends the existing WP GraphQL mutations. |
|
196 | + * |
|
197 | + * @since $VID:$ |
|
198 | + */ |
|
199 | + public function extendMutations() |
|
200 | + { |
|
201 | + add_action( |
|
202 | + 'graphql_post_object_mutation_update_additional_data', |
|
203 | + VenueUpdate::mutateFields($this->model, $this), |
|
204 | + 10, |
|
205 | + 6 |
|
206 | + ); |
|
207 | + } |
|
208 | 208 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function __construct(EEM_Venue $venue_model) |
30 | 30 | { |
31 | 31 | $this->model = $venue_model; |
32 | - $this->setName($this->namespace . 'Venue'); |
|
32 | + $this->setName($this->namespace.'Venue'); |
|
33 | 33 | $this->setIsCustomPostType(true); |
34 | 34 | parent::__construct(); |
35 | 35 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ), |
117 | 117 | new GraphQLOutputField( |
118 | 118 | 'state', |
119 | - $this->namespace . 'State', |
|
119 | + $this->namespace.'State', |
|
120 | 120 | null, |
121 | 121 | esc_html__('Venue state', 'event_espresso') |
122 | 122 | ), |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | ), |
129 | 129 | new GraphQLOutputField( |
130 | 130 | 'country', |
131 | - $this->namespace . 'Country', |
|
131 | + $this->namespace.'Country', |
|
132 | 132 | null, |
133 | 133 | esc_html__('Venue country', 'event_espresso') |
134 | 134 | ), |