@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | class Venues extends GraphQLData |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @param array $where_params |
|
18 | - * @return array|null |
|
19 | - * @since $VID:$ |
|
20 | - */ |
|
21 | - public function getData(array $where_params = []) |
|
22 | - { |
|
23 | - $field_key = lcfirst($this->namespace) . 'Venues'; |
|
24 | - $query = <<<QUERY |
|
16 | + /** |
|
17 | + * @param array $where_params |
|
18 | + * @return array|null |
|
19 | + * @since $VID:$ |
|
20 | + */ |
|
21 | + public function getData(array $where_params = []) |
|
22 | + { |
|
23 | + $field_key = lcfirst($this->namespace) . 'Venues'; |
|
24 | + $query = <<<QUERY |
|
25 | 25 | query GET_VENUES(\$where: RootQueryTo{$this->namespace}VenueConnectionWhereArgs, \$first: Int, \$last: Int ) { |
26 | 26 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
27 | 27 | nodes { |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | QUERY; |
44 | - $this->setParams([ |
|
45 | - 'operation_name' => 'GET_VENUES', |
|
46 | - 'variables' => [ |
|
47 | - 'first' => 100, |
|
48 | - ], |
|
49 | - 'query' => $query, |
|
50 | - ]); |
|
44 | + $this->setParams([ |
|
45 | + 'operation_name' => 'GET_VENUES', |
|
46 | + 'variables' => [ |
|
47 | + 'first' => 100, |
|
48 | + ], |
|
49 | + 'query' => $query, |
|
50 | + ]); |
|
51 | 51 | |
52 | - return $this->getQueryResponse($field_key, $where_params); |
|
53 | - } |
|
52 | + return $this->getQueryResponse($field_key, $where_params); |
|
53 | + } |
|
54 | 54 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function getData(array $where_params = []) |
22 | 22 | { |
23 | - $field_key = lcfirst($this->namespace) . 'Venues'; |
|
23 | + $field_key = lcfirst($this->namespace).'Venues'; |
|
24 | 24 | $query = <<<QUERY |
25 | 25 | query GET_VENUES(\$where: RootQueryTo{$this->namespace}VenueConnectionWhereArgs, \$first: Int, \$last: Int ) { |
26 | 26 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
@@ -18,128 +18,128 @@ |
||
18 | 18 | class EspressoEventEditor extends EspressoEventsAdmin |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * returns true if the current request matches this route |
|
23 | - * |
|
24 | - * @return bool |
|
25 | - * @since $VID:$ |
|
26 | - */ |
|
27 | - public function matchesCurrentRequest(): bool |
|
28 | - { |
|
29 | - return parent::matchesCurrentRequest() |
|
30 | - && $this->admin_config->useAdvancedEditor() |
|
31 | - && ( |
|
32 | - $this->request->getRequestParam('action') === 'create_new' |
|
33 | - || $this->request->getRequestParam('action') === 'edit' |
|
34 | - ); |
|
35 | - } |
|
21 | + /** |
|
22 | + * returns true if the current request matches this route |
|
23 | + * |
|
24 | + * @return bool |
|
25 | + * @since $VID:$ |
|
26 | + */ |
|
27 | + public function matchesCurrentRequest(): bool |
|
28 | + { |
|
29 | + return parent::matchesCurrentRequest() |
|
30 | + && $this->admin_config->useAdvancedEditor() |
|
31 | + && ( |
|
32 | + $this->request->getRequestParam('action') === 'create_new' |
|
33 | + || $this->request->getRequestParam('action') === 'edit' |
|
34 | + ); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @since $VID:$ |
|
40 | - */ |
|
41 | - protected function registerDependencies() |
|
42 | - { |
|
43 | - $editor_dependencies = [ |
|
44 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => [ |
|
45 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache, |
|
46 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Event' => EE_Dependency_Map::load_from_cache, |
|
47 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache, |
|
48 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache, |
|
49 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache, |
|
50 | - 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache, |
|
51 | - '\EventEspresso\core\domain\services\admin\events\editor\EventManagerData' => EE_Dependency_Map::load_from_cache, |
|
52 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache, |
|
53 | - 'EventEspresso\core\domain\services\admin\events\editor\TicketMeta' => EE_Dependency_Map::load_from_cache, |
|
54 | - 'EventEspresso\core\domain\services\admin\events\editor\FormBuilder' => EE_Dependency_Map::load_from_cache, |
|
55 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Venues' => EE_Dependency_Map::load_from_cache, |
|
56 | - ], |
|
57 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => [ |
|
58 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
59 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
60 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
61 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
62 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
63 | - 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
64 | - ], |
|
65 | - 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => [ |
|
66 | - 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache, |
|
67 | - 'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => EE_Dependency_Map::load_from_cache, |
|
68 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
69 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
70 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
71 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
72 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
73 | - 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
74 | - ], |
|
75 | - 'EventEspresso\core\domain\services\admin\events\editor\TicketMeta' => [ |
|
76 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
77 | - ], |
|
78 | - 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => [ |
|
79 | - 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache, |
|
80 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
81 | - ], |
|
82 | - 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => [ |
|
83 | - 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache, |
|
84 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
85 | - ], |
|
86 | - 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => [ |
|
87 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
88 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
89 | - ], |
|
90 | - 'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => [ |
|
91 | - 'EEM_Form_Element' => EE_Dependency_Map::load_from_cache, |
|
92 | - 'EEM_Form_Section' => EE_Dependency_Map::load_from_cache, |
|
93 | - ], |
|
94 | - 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' => [ |
|
95 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache, |
|
96 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
97 | - ], |
|
98 | - 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' => [ |
|
99 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
100 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
101 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
102 | - ], |
|
103 | - 'EventEspresso\core\domain\services\admin\events\editor\EventManagerData' => [ |
|
104 | - 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
105 | - 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
106 | - ], |
|
107 | - ]; |
|
108 | - foreach ($editor_dependencies as $dependency => $dependencies) { |
|
109 | - $this->dependency_map->registerDependencies($dependency, $dependencies); |
|
110 | - } |
|
111 | - } |
|
38 | + /** |
|
39 | + * @since $VID:$ |
|
40 | + */ |
|
41 | + protected function registerDependencies() |
|
42 | + { |
|
43 | + $editor_dependencies = [ |
|
44 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => [ |
|
45 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache, |
|
46 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Event' => EE_Dependency_Map::load_from_cache, |
|
47 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache, |
|
48 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache, |
|
49 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache, |
|
50 | + 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache, |
|
51 | + '\EventEspresso\core\domain\services\admin\events\editor\EventManagerData' => EE_Dependency_Map::load_from_cache, |
|
52 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache, |
|
53 | + 'EventEspresso\core\domain\services\admin\events\editor\TicketMeta' => EE_Dependency_Map::load_from_cache, |
|
54 | + 'EventEspresso\core\domain\services\admin\events\editor\FormBuilder' => EE_Dependency_Map::load_from_cache, |
|
55 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Venues' => EE_Dependency_Map::load_from_cache, |
|
56 | + ], |
|
57 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => [ |
|
58 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
59 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
60 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
61 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
62 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
63 | + 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
64 | + ], |
|
65 | + 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => [ |
|
66 | + 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache, |
|
67 | + 'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => EE_Dependency_Map::load_from_cache, |
|
68 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
69 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
70 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
71 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
72 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
73 | + 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
74 | + ], |
|
75 | + 'EventEspresso\core\domain\services\admin\events\editor\TicketMeta' => [ |
|
76 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
77 | + ], |
|
78 | + 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => [ |
|
79 | + 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache, |
|
80 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
81 | + ], |
|
82 | + 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => [ |
|
83 | + 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache, |
|
84 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
85 | + ], |
|
86 | + 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => [ |
|
87 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
88 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
89 | + ], |
|
90 | + 'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => [ |
|
91 | + 'EEM_Form_Element' => EE_Dependency_Map::load_from_cache, |
|
92 | + 'EEM_Form_Section' => EE_Dependency_Map::load_from_cache, |
|
93 | + ], |
|
94 | + 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' => [ |
|
95 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache, |
|
96 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
97 | + ], |
|
98 | + 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' => [ |
|
99 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
100 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
101 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
102 | + ], |
|
103 | + 'EventEspresso\core\domain\services\admin\events\editor\EventManagerData' => [ |
|
104 | + 'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache, |
|
105 | + 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
106 | + ], |
|
107 | + ]; |
|
108 | + foreach ($editor_dependencies as $dependency => $dependencies) { |
|
109 | + $this->dependency_map->registerDependencies($dependency, $dependencies); |
|
110 | + } |
|
111 | + } |
|
112 | 112 | |
113 | 113 | |
114 | - /** |
|
115 | - * @return string |
|
116 | - */ |
|
117 | - protected function dataNodeClass(): string |
|
118 | - { |
|
119 | - return EventEditor::class; |
|
120 | - } |
|
114 | + /** |
|
115 | + * @return string |
|
116 | + */ |
|
117 | + protected function dataNodeClass(): string |
|
118 | + { |
|
119 | + return EventEditor::class; |
|
120 | + } |
|
121 | 121 | |
122 | 122 | |
123 | - /** |
|
124 | - * implements logic required to run during request |
|
125 | - * |
|
126 | - * @return bool |
|
127 | - * @since $VID:$ |
|
128 | - */ |
|
129 | - protected function requestHandler(): bool |
|
130 | - { |
|
131 | - if (! class_exists('WPGraphQL')) { |
|
132 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
133 | - } |
|
134 | - /** @var GraphQLManager $graphQL_manager */ |
|
135 | - $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager'); |
|
136 | - $graphQL_manager->init(); |
|
123 | + /** |
|
124 | + * implements logic required to run during request |
|
125 | + * |
|
126 | + * @return bool |
|
127 | + * @since $VID:$ |
|
128 | + */ |
|
129 | + protected function requestHandler(): bool |
|
130 | + { |
|
131 | + if (! class_exists('WPGraphQL')) { |
|
132 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
133 | + } |
|
134 | + /** @var GraphQLManager $graphQL_manager */ |
|
135 | + $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager'); |
|
136 | + $graphQL_manager->init(); |
|
137 | 137 | |
138 | - /** @var EventEditorAssetManager $asset_manager */ |
|
139 | - $asset_manager = $this->loader->getShared( |
|
140 | - 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' |
|
141 | - ); |
|
142 | - add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']); |
|
143 | - return true; |
|
144 | - } |
|
138 | + /** @var EventEditorAssetManager $asset_manager */ |
|
139 | + $asset_manager = $this->loader->getShared( |
|
140 | + 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' |
|
141 | + ); |
|
142 | + add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']); |
|
143 | + return true; |
|
144 | + } |
|
145 | 145 | } |
@@ -22,150 +22,150 @@ |
||
22 | 22 | class EventEditorGraphQLData |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var Event |
|
27 | - */ |
|
28 | - protected $event; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var Datetimes |
|
32 | - */ |
|
33 | - protected $datetimes; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var Prices |
|
37 | - */ |
|
38 | - protected $prices; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var PriceTypes |
|
42 | - */ |
|
43 | - protected $price_types; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var Tickets |
|
47 | - */ |
|
48 | - protected $tickets; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var EventEntityRelations |
|
52 | - */ |
|
53 | - protected $relations; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var EventManagerData |
|
57 | - */ |
|
58 | - protected $managers; |
|
59 | - |
|
60 | - /** |
|
61 | - * @var NewEventDefaultEntities |
|
62 | - */ |
|
63 | - protected $default_entities; |
|
64 | - |
|
65 | - /** |
|
66 | - * @var TicketMeta |
|
67 | - */ |
|
68 | - protected $ticket_meta; |
|
69 | - |
|
70 | - /** |
|
71 | - * @var FormBuilder |
|
72 | - */ |
|
73 | - protected $form_builder; |
|
74 | - |
|
75 | - /** |
|
76 | - * @var Venues |
|
77 | - */ |
|
78 | - protected $venues; |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * EventEditorGraphQLData constructor. |
|
83 | - * |
|
84 | - * @param Datetimes $datetimes |
|
85 | - * @param Event $event |
|
86 | - * @param Prices $prices |
|
87 | - * @param PriceTypes $price_types |
|
88 | - * @param Tickets $tickets |
|
89 | - * @param EventEntityRelations $relations |
|
90 | - * @param EventManagerData $managers |
|
91 | - * @param NewEventDefaultEntities $default_entities |
|
92 | - * @param TicketMeta $ticket_meta |
|
93 | - * @param FormBuilder $form_builder |
|
94 | - * @param Venues $venues |
|
95 | - */ |
|
96 | - public function __construct( |
|
97 | - Datetimes $datetimes, |
|
98 | - Event $event, |
|
99 | - Prices $prices, |
|
100 | - PriceTypes $price_types, |
|
101 | - Tickets $tickets, |
|
102 | - EventEntityRelations $relations, |
|
103 | - EventManagerData $managers, |
|
104 | - NewEventDefaultEntities $default_entities, |
|
105 | - TicketMeta $ticket_meta, |
|
106 | - FormBuilder $form_builder, |
|
107 | - Venues $venues |
|
108 | - ) { |
|
109 | - $this->datetimes = $datetimes; |
|
110 | - $this->event = $event; |
|
111 | - $this->default_entities = $default_entities; |
|
112 | - $this->prices = $prices; |
|
113 | - $this->price_types = $price_types; |
|
114 | - $this->managers = $managers; |
|
115 | - $this->relations = $relations; |
|
116 | - $this->tickets = $tickets; |
|
117 | - $this->ticket_meta = $ticket_meta; |
|
118 | - $this->form_builder = $form_builder; |
|
119 | - $this->venues = $venues; |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - /** |
|
124 | - * @param int $eventId |
|
125 | - * @return array |
|
126 | - * @throws EE_Error |
|
127 | - * @throws ReflectionException |
|
128 | - * @since $VID:$ |
|
129 | - */ |
|
130 | - public function getData(int $eventId) |
|
131 | - { |
|
132 | - $this->default_entities->getData($eventId); |
|
133 | - $event = $this->event->getData(['id' => $eventId]); |
|
134 | - $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
135 | - $eventManagers = $this->managers ->getData($eventId); |
|
136 | - |
|
137 | - $tickets = $this->tickets->getData([ |
|
138 | - 'eventId' => $eventId, |
|
139 | - 'includeDefaultTickets' => true, |
|
140 | - ]); |
|
141 | - |
|
142 | - $prices = $this->prices->getData([ |
|
143 | - 'eventId' => $eventId, |
|
144 | - 'includeDefaultTicketsPrices' => true, |
|
145 | - 'includeDefaultPrices' => true, |
|
146 | - ]); |
|
147 | - |
|
148 | - $priceTypes = $this->price_types->getData(); |
|
149 | - |
|
150 | - $relations = $this->relations->getData($eventId); |
|
151 | - |
|
152 | - $ticketMeta = $this->ticket_meta->getData($eventId); |
|
153 | - |
|
154 | - $formBuilder = $this->form_builder->getData($eventId); |
|
155 | - |
|
156 | - $venues = $this->venues->getData(); |
|
157 | - |
|
158 | - return compact( |
|
159 | - 'datetimes', |
|
160 | - 'event', |
|
161 | - 'eventManagers', |
|
162 | - 'formBuilder', |
|
163 | - 'prices', |
|
164 | - 'priceTypes', |
|
165 | - 'relations', |
|
166 | - 'tickets', |
|
167 | - 'ticketMeta', |
|
168 | - 'venues' |
|
169 | - ); |
|
170 | - } |
|
25 | + /** |
|
26 | + * @var Event |
|
27 | + */ |
|
28 | + protected $event; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var Datetimes |
|
32 | + */ |
|
33 | + protected $datetimes; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var Prices |
|
37 | + */ |
|
38 | + protected $prices; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var PriceTypes |
|
42 | + */ |
|
43 | + protected $price_types; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var Tickets |
|
47 | + */ |
|
48 | + protected $tickets; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var EventEntityRelations |
|
52 | + */ |
|
53 | + protected $relations; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var EventManagerData |
|
57 | + */ |
|
58 | + protected $managers; |
|
59 | + |
|
60 | + /** |
|
61 | + * @var NewEventDefaultEntities |
|
62 | + */ |
|
63 | + protected $default_entities; |
|
64 | + |
|
65 | + /** |
|
66 | + * @var TicketMeta |
|
67 | + */ |
|
68 | + protected $ticket_meta; |
|
69 | + |
|
70 | + /** |
|
71 | + * @var FormBuilder |
|
72 | + */ |
|
73 | + protected $form_builder; |
|
74 | + |
|
75 | + /** |
|
76 | + * @var Venues |
|
77 | + */ |
|
78 | + protected $venues; |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * EventEditorGraphQLData constructor. |
|
83 | + * |
|
84 | + * @param Datetimes $datetimes |
|
85 | + * @param Event $event |
|
86 | + * @param Prices $prices |
|
87 | + * @param PriceTypes $price_types |
|
88 | + * @param Tickets $tickets |
|
89 | + * @param EventEntityRelations $relations |
|
90 | + * @param EventManagerData $managers |
|
91 | + * @param NewEventDefaultEntities $default_entities |
|
92 | + * @param TicketMeta $ticket_meta |
|
93 | + * @param FormBuilder $form_builder |
|
94 | + * @param Venues $venues |
|
95 | + */ |
|
96 | + public function __construct( |
|
97 | + Datetimes $datetimes, |
|
98 | + Event $event, |
|
99 | + Prices $prices, |
|
100 | + PriceTypes $price_types, |
|
101 | + Tickets $tickets, |
|
102 | + EventEntityRelations $relations, |
|
103 | + EventManagerData $managers, |
|
104 | + NewEventDefaultEntities $default_entities, |
|
105 | + TicketMeta $ticket_meta, |
|
106 | + FormBuilder $form_builder, |
|
107 | + Venues $venues |
|
108 | + ) { |
|
109 | + $this->datetimes = $datetimes; |
|
110 | + $this->event = $event; |
|
111 | + $this->default_entities = $default_entities; |
|
112 | + $this->prices = $prices; |
|
113 | + $this->price_types = $price_types; |
|
114 | + $this->managers = $managers; |
|
115 | + $this->relations = $relations; |
|
116 | + $this->tickets = $tickets; |
|
117 | + $this->ticket_meta = $ticket_meta; |
|
118 | + $this->form_builder = $form_builder; |
|
119 | + $this->venues = $venues; |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + /** |
|
124 | + * @param int $eventId |
|
125 | + * @return array |
|
126 | + * @throws EE_Error |
|
127 | + * @throws ReflectionException |
|
128 | + * @since $VID:$ |
|
129 | + */ |
|
130 | + public function getData(int $eventId) |
|
131 | + { |
|
132 | + $this->default_entities->getData($eventId); |
|
133 | + $event = $this->event->getData(['id' => $eventId]); |
|
134 | + $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
135 | + $eventManagers = $this->managers ->getData($eventId); |
|
136 | + |
|
137 | + $tickets = $this->tickets->getData([ |
|
138 | + 'eventId' => $eventId, |
|
139 | + 'includeDefaultTickets' => true, |
|
140 | + ]); |
|
141 | + |
|
142 | + $prices = $this->prices->getData([ |
|
143 | + 'eventId' => $eventId, |
|
144 | + 'includeDefaultTicketsPrices' => true, |
|
145 | + 'includeDefaultPrices' => true, |
|
146 | + ]); |
|
147 | + |
|
148 | + $priceTypes = $this->price_types->getData(); |
|
149 | + |
|
150 | + $relations = $this->relations->getData($eventId); |
|
151 | + |
|
152 | + $ticketMeta = $this->ticket_meta->getData($eventId); |
|
153 | + |
|
154 | + $formBuilder = $this->form_builder->getData($eventId); |
|
155 | + |
|
156 | + $venues = $this->venues->getData(); |
|
157 | + |
|
158 | + return compact( |
|
159 | + 'datetimes', |
|
160 | + 'event', |
|
161 | + 'eventManagers', |
|
162 | + 'formBuilder', |
|
163 | + 'prices', |
|
164 | + 'priceTypes', |
|
165 | + 'relations', |
|
166 | + 'tickets', |
|
167 | + 'ticketMeta', |
|
168 | + 'venues' |
|
169 | + ); |
|
170 | + } |
|
171 | 171 | } |
@@ -21,114 +21,114 @@ |
||
21 | 21 | class EventMutation |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Maps the GraphQL input to a format that the model functions can use |
|
26 | - * |
|
27 | - * @param array $input Data coming from the GraphQL mutation query input |
|
28 | - * @return array |
|
29 | - * @throws Exception |
|
30 | - */ |
|
31 | - public static function prepareFields(array $input): array |
|
32 | - { |
|
33 | - $args = []; |
|
34 | - |
|
35 | - if (array_key_exists('allowDonations', $input)) { |
|
36 | - $args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN); |
|
37 | - } |
|
38 | - |
|
39 | - if (array_key_exists('allowOverflow', $input)) { |
|
40 | - $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN); |
|
41 | - } |
|
42 | - |
|
43 | - if (array_key_exists('altRegPage', $input)) { |
|
44 | - $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']); |
|
45 | - } |
|
46 | - |
|
47 | - if (! empty($input['defaultRegStatus'])) { |
|
48 | - $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']); |
|
49 | - } |
|
50 | - |
|
51 | - if (! empty($input['description'])) { |
|
52 | - $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db'); |
|
53 | - } |
|
54 | - |
|
55 | - if (array_key_exists('displayDescription', $input)) { |
|
56 | - $args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN); |
|
57 | - } |
|
58 | - |
|
59 | - if (array_key_exists('displayTicketSelector', $input)) { |
|
60 | - $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN); |
|
61 | - } |
|
62 | - |
|
63 | - if (! empty($input['maxRegistrations'])) { |
|
64 | - $args['EVT_additional_limit'] = absint($input['maxRegistrations']); |
|
65 | - } |
|
66 | - |
|
67 | - if (array_key_exists('memberOnly', $input)) { |
|
68 | - $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN); |
|
69 | - } |
|
70 | - |
|
71 | - if (! empty($input['name'])) { |
|
72 | - $args['EVT_name'] = sanitize_text_field($input['name']); |
|
73 | - } |
|
74 | - |
|
75 | - if (array_key_exists('order', $input)) { |
|
76 | - $args['EVT_order'] = absint($input['order']); |
|
77 | - } |
|
78 | - |
|
79 | - if (array_key_exists('phoneNumber', $input)) { |
|
80 | - $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']); |
|
81 | - } |
|
82 | - |
|
83 | - if (array_key_exists('shortDescription', $input)) { |
|
84 | - $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db'); |
|
85 | - } |
|
86 | - |
|
87 | - if (array_key_exists('timezoneString', $input)) { |
|
88 | - $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
89 | - } |
|
90 | - |
|
91 | - if (! empty($input['visibleOn'])) { |
|
92 | - $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
93 | - } |
|
94 | - |
|
95 | - if (! empty($input['manager'])) { |
|
96 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['manager'])); |
|
97 | - $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null; |
|
98 | - } |
|
99 | - |
|
100 | - if (array_key_exists('venue', $input)) { |
|
101 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['venue'])); |
|
102 | - $args['venue'] = ! empty($parts['id']) ? $parts['id'] : 0; |
|
103 | - } |
|
104 | - |
|
105 | - return apply_filters( |
|
106 | - 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args', |
|
107 | - $args, |
|
108 | - $input |
|
109 | - ); |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - /** |
|
114 | - * Sets the venue for the event. |
|
115 | - * |
|
116 | - * @param EE_Event $entity The event instance. |
|
117 | - * @param int $venue The venue ID |
|
118 | - * @throws EE_Error |
|
119 | - * @throws InvalidDataTypeException |
|
120 | - * @throws InvalidInterfaceException |
|
121 | - * @throws InvalidArgumentException |
|
122 | - * @throws ReflectionException |
|
123 | - */ |
|
124 | - public static function setEventVenue(EE_Event $entity, int $venue) |
|
125 | - { |
|
126 | - $relationName = 'Venue'; |
|
127 | - // Remove the existing venues |
|
128 | - $entity->_remove_relations($relationName); |
|
129 | - |
|
130 | - if ($venue) { |
|
131 | - $entity->add_venue($venue); |
|
132 | - } |
|
133 | - } |
|
24 | + /** |
|
25 | + * Maps the GraphQL input to a format that the model functions can use |
|
26 | + * |
|
27 | + * @param array $input Data coming from the GraphQL mutation query input |
|
28 | + * @return array |
|
29 | + * @throws Exception |
|
30 | + */ |
|
31 | + public static function prepareFields(array $input): array |
|
32 | + { |
|
33 | + $args = []; |
|
34 | + |
|
35 | + if (array_key_exists('allowDonations', $input)) { |
|
36 | + $args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN); |
|
37 | + } |
|
38 | + |
|
39 | + if (array_key_exists('allowOverflow', $input)) { |
|
40 | + $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN); |
|
41 | + } |
|
42 | + |
|
43 | + if (array_key_exists('altRegPage', $input)) { |
|
44 | + $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']); |
|
45 | + } |
|
46 | + |
|
47 | + if (! empty($input['defaultRegStatus'])) { |
|
48 | + $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']); |
|
49 | + } |
|
50 | + |
|
51 | + if (! empty($input['description'])) { |
|
52 | + $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db'); |
|
53 | + } |
|
54 | + |
|
55 | + if (array_key_exists('displayDescription', $input)) { |
|
56 | + $args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN); |
|
57 | + } |
|
58 | + |
|
59 | + if (array_key_exists('displayTicketSelector', $input)) { |
|
60 | + $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN); |
|
61 | + } |
|
62 | + |
|
63 | + if (! empty($input['maxRegistrations'])) { |
|
64 | + $args['EVT_additional_limit'] = absint($input['maxRegistrations']); |
|
65 | + } |
|
66 | + |
|
67 | + if (array_key_exists('memberOnly', $input)) { |
|
68 | + $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN); |
|
69 | + } |
|
70 | + |
|
71 | + if (! empty($input['name'])) { |
|
72 | + $args['EVT_name'] = sanitize_text_field($input['name']); |
|
73 | + } |
|
74 | + |
|
75 | + if (array_key_exists('order', $input)) { |
|
76 | + $args['EVT_order'] = absint($input['order']); |
|
77 | + } |
|
78 | + |
|
79 | + if (array_key_exists('phoneNumber', $input)) { |
|
80 | + $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']); |
|
81 | + } |
|
82 | + |
|
83 | + if (array_key_exists('shortDescription', $input)) { |
|
84 | + $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db'); |
|
85 | + } |
|
86 | + |
|
87 | + if (array_key_exists('timezoneString', $input)) { |
|
88 | + $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
89 | + } |
|
90 | + |
|
91 | + if (! empty($input['visibleOn'])) { |
|
92 | + $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
93 | + } |
|
94 | + |
|
95 | + if (! empty($input['manager'])) { |
|
96 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['manager'])); |
|
97 | + $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null; |
|
98 | + } |
|
99 | + |
|
100 | + if (array_key_exists('venue', $input)) { |
|
101 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['venue'])); |
|
102 | + $args['venue'] = ! empty($parts['id']) ? $parts['id'] : 0; |
|
103 | + } |
|
104 | + |
|
105 | + return apply_filters( |
|
106 | + 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args', |
|
107 | + $args, |
|
108 | + $input |
|
109 | + ); |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + /** |
|
114 | + * Sets the venue for the event. |
|
115 | + * |
|
116 | + * @param EE_Event $entity The event instance. |
|
117 | + * @param int $venue The venue ID |
|
118 | + * @throws EE_Error |
|
119 | + * @throws InvalidDataTypeException |
|
120 | + * @throws InvalidInterfaceException |
|
121 | + * @throws InvalidArgumentException |
|
122 | + * @throws ReflectionException |
|
123 | + */ |
|
124 | + public static function setEventVenue(EE_Event $entity, int $venue) |
|
125 | + { |
|
126 | + $relationName = 'Venue'; |
|
127 | + // Remove the existing venues |
|
128 | + $entity->_remove_relations($relationName); |
|
129 | + |
|
130 | + if ($venue) { |
|
131 | + $entity->add_venue($venue); |
|
132 | + } |
|
133 | + } |
|
134 | 134 | } |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']); |
45 | 45 | } |
46 | 46 | |
47 | - if (! empty($input['defaultRegStatus'])) { |
|
47 | + if ( ! empty($input['defaultRegStatus'])) { |
|
48 | 48 | $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']); |
49 | 49 | } |
50 | 50 | |
51 | - if (! empty($input['description'])) { |
|
51 | + if ( ! empty($input['description'])) { |
|
52 | 52 | $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db'); |
53 | 53 | } |
54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN); |
61 | 61 | } |
62 | 62 | |
63 | - if (! empty($input['maxRegistrations'])) { |
|
63 | + if ( ! empty($input['maxRegistrations'])) { |
|
64 | 64 | $args['EVT_additional_limit'] = absint($input['maxRegistrations']); |
65 | 65 | } |
66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN); |
69 | 69 | } |
70 | 70 | |
71 | - if (! empty($input['name'])) { |
|
71 | + if ( ! empty($input['name'])) { |
|
72 | 72 | $args['EVT_name'] = sanitize_text_field($input['name']); |
73 | 73 | } |
74 | 74 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
89 | 89 | } |
90 | 90 | |
91 | - if (! empty($input['visibleOn'])) { |
|
91 | + if ( ! empty($input['visibleOn'])) { |
|
92 | 92 | $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
93 | 93 | } |
94 | 94 | |
95 | - if (! empty($input['manager'])) { |
|
95 | + if ( ! empty($input['manager'])) { |
|
96 | 96 | $parts = Relay::fromGlobalId(sanitize_text_field($input['manager'])); |
97 | 97 | $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null; |
98 | 98 | } |
@@ -22,211 +22,211 @@ |
||
22 | 22 | class Venue extends TypeBase |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * Venue constructor. |
|
27 | - * |
|
28 | - * @param EEM_Venue $venue_model |
|
29 | - */ |
|
30 | - public function __construct(EEM_Venue $venue_model) |
|
31 | - { |
|
32 | - $this->setName($this->namespace . 'Venue'); |
|
33 | - $this->setIsCustomPostType(true); |
|
34 | - parent::__construct($venue_model); |
|
35 | - } |
|
25 | + /** |
|
26 | + * Venue constructor. |
|
27 | + * |
|
28 | + * @param EEM_Venue $venue_model |
|
29 | + */ |
|
30 | + public function __construct(EEM_Venue $venue_model) |
|
31 | + { |
|
32 | + $this->setName($this->namespace . 'Venue'); |
|
33 | + $this->setIsCustomPostType(true); |
|
34 | + parent::__construct($venue_model); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @return GraphQLFieldInterface[] |
|
40 | - */ |
|
41 | - public function getFields(): array |
|
42 | - { |
|
43 | - $fields = [ |
|
44 | - new GraphQLOutputField( |
|
45 | - 'dbId', |
|
46 | - ['non_null' => 'Int'], |
|
47 | - 'ID', |
|
48 | - esc_html__('The venue ID.', '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 | - 'name', |
|
58 | - 'String', |
|
59 | - 'name', |
|
60 | - esc_html__('Venue Name', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'description', |
|
64 | - 'String', |
|
65 | - 'description', |
|
66 | - esc_html__('Venue Description', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'shortDescription', |
|
70 | - 'String', |
|
71 | - 'excerpt', |
|
72 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'identifier', |
|
76 | - 'String', |
|
77 | - 'identifier', |
|
78 | - esc_html__('Venue Identifier', 'event_espresso') |
|
79 | - ), |
|
80 | - new GraphQLField( |
|
81 | - 'created', |
|
82 | - 'String', |
|
83 | - 'created', |
|
84 | - esc_html__('Date Venue Created', 'event_espresso') |
|
85 | - ), |
|
86 | - new GraphQLField( |
|
87 | - 'order', |
|
88 | - 'Int', |
|
89 | - 'order', |
|
90 | - esc_html__('Venue order', 'event_espresso') |
|
91 | - ), |
|
92 | - new GraphQLOutputField( |
|
93 | - 'wpUser', |
|
94 | - 'User', |
|
95 | - null, |
|
96 | - esc_html__('Venue Creator', 'event_espresso') |
|
97 | - ), |
|
98 | - new GraphQLInputField( |
|
99 | - 'wpUser', |
|
100 | - 'Int', |
|
101 | - null, |
|
102 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
103 | - ), |
|
104 | - new GraphQLField( |
|
105 | - 'address', |
|
106 | - 'String', |
|
107 | - 'address', |
|
108 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLField( |
|
111 | - 'address2', |
|
112 | - 'String', |
|
113 | - 'address2', |
|
114 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLField( |
|
117 | - 'city', |
|
118 | - 'String', |
|
119 | - 'city', |
|
120 | - esc_html__('Venue City', 'event_espresso') |
|
121 | - ), |
|
122 | - new GraphQLOutputField( |
|
123 | - 'state', |
|
124 | - $this->namespace . 'State', |
|
125 | - null, |
|
126 | - esc_html__('Venue state', 'event_espresso') |
|
127 | - ), |
|
128 | - new GraphQLOutputField( |
|
129 | - 'stateName', |
|
130 | - 'String', |
|
131 | - 'state_name', |
|
132 | - esc_html__('Venue state name', 'event_espresso') |
|
133 | - ), |
|
134 | - new GraphQLInputField( |
|
135 | - 'state', |
|
136 | - 'Int', |
|
137 | - null, |
|
138 | - esc_html__('State ID', 'event_espresso') |
|
139 | - ), |
|
140 | - new GraphQLOutputField( |
|
141 | - 'country', |
|
142 | - $this->namespace . 'Country', |
|
143 | - null, |
|
144 | - esc_html__('Venue country', 'event_espresso') |
|
145 | - ), |
|
146 | - new GraphQLOutputField( |
|
147 | - 'countryName', |
|
148 | - 'String', |
|
149 | - 'country_name', |
|
150 | - esc_html__('Venue country name', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLInputField( |
|
153 | - 'country', |
|
154 | - 'String', |
|
155 | - null, |
|
156 | - esc_html__('Country ISO Code', 'event_espresso') |
|
157 | - ), |
|
158 | - new GraphQLField( |
|
159 | - 'zip', |
|
160 | - 'String', |
|
161 | - 'zip', |
|
162 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
163 | - ), |
|
164 | - new GraphQLField( |
|
165 | - 'capacity', |
|
166 | - 'Int', |
|
167 | - 'capacity', |
|
168 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
169 | - [$this, 'parseInfiniteValue'] |
|
170 | - ), |
|
171 | - new GraphQLField( |
|
172 | - 'phone', |
|
173 | - 'String', |
|
174 | - 'phone', |
|
175 | - esc_html__('Venue Phone', 'event_espresso') |
|
176 | - ), |
|
177 | - new GraphQLField( |
|
178 | - 'virtualPhone', |
|
179 | - 'String', |
|
180 | - 'virtual_phone', |
|
181 | - esc_html__('Call in Number', 'event_espresso') |
|
182 | - ), |
|
183 | - new GraphQLField( |
|
184 | - 'url', |
|
185 | - 'String', |
|
186 | - 'venue_url', |
|
187 | - esc_html__('Venue Website', 'event_espresso') |
|
188 | - ), |
|
189 | - new GraphQLField( |
|
190 | - 'virtualUrl', |
|
191 | - 'String', |
|
192 | - 'virtual_url', |
|
193 | - esc_html__('Virtual URL', 'event_espresso') |
|
194 | - ), |
|
195 | - new GraphQLField( |
|
196 | - 'googleMapLink', |
|
197 | - 'String', |
|
198 | - 'google_map_link', |
|
199 | - esc_html__('Google Map Link', 'event_espresso') |
|
200 | - ), |
|
201 | - new GraphQLField( |
|
202 | - 'enableForGmap', |
|
203 | - 'String', |
|
204 | - 'enable_for_gmap', |
|
205 | - esc_html__('Show Google Map?', 'event_espresso') |
|
206 | - ), |
|
207 | - ]; |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + */ |
|
41 | + public function getFields(): array |
|
42 | + { |
|
43 | + $fields = [ |
|
44 | + new GraphQLOutputField( |
|
45 | + 'dbId', |
|
46 | + ['non_null' => 'Int'], |
|
47 | + 'ID', |
|
48 | + esc_html__('The venue ID.', '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 | + 'name', |
|
58 | + 'String', |
|
59 | + 'name', |
|
60 | + esc_html__('Venue Name', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'description', |
|
64 | + 'String', |
|
65 | + 'description', |
|
66 | + esc_html__('Venue Description', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'shortDescription', |
|
70 | + 'String', |
|
71 | + 'excerpt', |
|
72 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'identifier', |
|
76 | + 'String', |
|
77 | + 'identifier', |
|
78 | + esc_html__('Venue Identifier', 'event_espresso') |
|
79 | + ), |
|
80 | + new GraphQLField( |
|
81 | + 'created', |
|
82 | + 'String', |
|
83 | + 'created', |
|
84 | + esc_html__('Date Venue Created', 'event_espresso') |
|
85 | + ), |
|
86 | + new GraphQLField( |
|
87 | + 'order', |
|
88 | + 'Int', |
|
89 | + 'order', |
|
90 | + esc_html__('Venue order', 'event_espresso') |
|
91 | + ), |
|
92 | + new GraphQLOutputField( |
|
93 | + 'wpUser', |
|
94 | + 'User', |
|
95 | + null, |
|
96 | + esc_html__('Venue Creator', 'event_espresso') |
|
97 | + ), |
|
98 | + new GraphQLInputField( |
|
99 | + 'wpUser', |
|
100 | + 'Int', |
|
101 | + null, |
|
102 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
103 | + ), |
|
104 | + new GraphQLField( |
|
105 | + 'address', |
|
106 | + 'String', |
|
107 | + 'address', |
|
108 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLField( |
|
111 | + 'address2', |
|
112 | + 'String', |
|
113 | + 'address2', |
|
114 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLField( |
|
117 | + 'city', |
|
118 | + 'String', |
|
119 | + 'city', |
|
120 | + esc_html__('Venue City', 'event_espresso') |
|
121 | + ), |
|
122 | + new GraphQLOutputField( |
|
123 | + 'state', |
|
124 | + $this->namespace . 'State', |
|
125 | + null, |
|
126 | + esc_html__('Venue state', 'event_espresso') |
|
127 | + ), |
|
128 | + new GraphQLOutputField( |
|
129 | + 'stateName', |
|
130 | + 'String', |
|
131 | + 'state_name', |
|
132 | + esc_html__('Venue state name', 'event_espresso') |
|
133 | + ), |
|
134 | + new GraphQLInputField( |
|
135 | + 'state', |
|
136 | + 'Int', |
|
137 | + null, |
|
138 | + esc_html__('State ID', 'event_espresso') |
|
139 | + ), |
|
140 | + new GraphQLOutputField( |
|
141 | + 'country', |
|
142 | + $this->namespace . 'Country', |
|
143 | + null, |
|
144 | + esc_html__('Venue country', 'event_espresso') |
|
145 | + ), |
|
146 | + new GraphQLOutputField( |
|
147 | + 'countryName', |
|
148 | + 'String', |
|
149 | + 'country_name', |
|
150 | + esc_html__('Venue country name', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLInputField( |
|
153 | + 'country', |
|
154 | + 'String', |
|
155 | + null, |
|
156 | + esc_html__('Country ISO Code', 'event_espresso') |
|
157 | + ), |
|
158 | + new GraphQLField( |
|
159 | + 'zip', |
|
160 | + 'String', |
|
161 | + 'zip', |
|
162 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
163 | + ), |
|
164 | + new GraphQLField( |
|
165 | + 'capacity', |
|
166 | + 'Int', |
|
167 | + 'capacity', |
|
168 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
169 | + [$this, 'parseInfiniteValue'] |
|
170 | + ), |
|
171 | + new GraphQLField( |
|
172 | + 'phone', |
|
173 | + 'String', |
|
174 | + 'phone', |
|
175 | + esc_html__('Venue Phone', 'event_espresso') |
|
176 | + ), |
|
177 | + new GraphQLField( |
|
178 | + 'virtualPhone', |
|
179 | + 'String', |
|
180 | + 'virtual_phone', |
|
181 | + esc_html__('Call in Number', 'event_espresso') |
|
182 | + ), |
|
183 | + new GraphQLField( |
|
184 | + 'url', |
|
185 | + 'String', |
|
186 | + 'venue_url', |
|
187 | + esc_html__('Venue Website', 'event_espresso') |
|
188 | + ), |
|
189 | + new GraphQLField( |
|
190 | + 'virtualUrl', |
|
191 | + 'String', |
|
192 | + 'virtual_url', |
|
193 | + esc_html__('Virtual URL', 'event_espresso') |
|
194 | + ), |
|
195 | + new GraphQLField( |
|
196 | + 'googleMapLink', |
|
197 | + 'String', |
|
198 | + 'google_map_link', |
|
199 | + esc_html__('Google Map Link', 'event_espresso') |
|
200 | + ), |
|
201 | + new GraphQLField( |
|
202 | + 'enableForGmap', |
|
203 | + 'String', |
|
204 | + 'enable_for_gmap', |
|
205 | + esc_html__('Show Google Map?', 'event_espresso') |
|
206 | + ), |
|
207 | + ]; |
|
208 | 208 | |
209 | - return apply_filters( |
|
210 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
211 | - $fields, |
|
212 | - $this->name, |
|
213 | - $this->model |
|
214 | - ); |
|
215 | - } |
|
209 | + return apply_filters( |
|
210 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
211 | + $fields, |
|
212 | + $this->name, |
|
213 | + $this->model |
|
214 | + ); |
|
215 | + } |
|
216 | 216 | |
217 | 217 | |
218 | - /** |
|
219 | - * Extends the existing WP GraphQL mutations. |
|
220 | - * |
|
221 | - * @return void |
|
222 | - */ |
|
223 | - public function extendMutations() |
|
224 | - { |
|
225 | - add_action( |
|
226 | - 'graphql_post_object_mutation_update_additional_data', |
|
227 | - VenueUpdate::mutateFields($this->model, $this), |
|
228 | - 10, |
|
229 | - 6 |
|
230 | - ); |
|
231 | - } |
|
218 | + /** |
|
219 | + * Extends the existing WP GraphQL mutations. |
|
220 | + * |
|
221 | + * @return void |
|
222 | + */ |
|
223 | + public function extendMutations() |
|
224 | + { |
|
225 | + add_action( |
|
226 | + 'graphql_post_object_mutation_update_additional_data', |
|
227 | + VenueUpdate::mutateFields($this->model, $this), |
|
228 | + 10, |
|
229 | + 6 |
|
230 | + ); |
|
231 | + } |
|
232 | 232 | } |
@@ -25,230 +25,230 @@ |
||
25 | 25 | class Event extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Event constructor. |
|
30 | - * |
|
31 | - * @param EEM_Event $event_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Event $event_model) |
|
34 | - { |
|
35 | - $this->setName($this->namespace . 'Event'); |
|
36 | - $this->setIsCustomPostType(true); |
|
37 | - parent::__construct($event_model); |
|
38 | - } |
|
28 | + /** |
|
29 | + * Event constructor. |
|
30 | + * |
|
31 | + * @param EEM_Event $event_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Event $event_model) |
|
34 | + { |
|
35 | + $this->setName($this->namespace . 'Event'); |
|
36 | + $this->setIsCustomPostType(true); |
|
37 | + parent::__construct($event_model); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @return GraphQLFieldInterface[] |
|
43 | - */ |
|
44 | - public function getFields(): array |
|
45 | - { |
|
46 | - $fields = [ |
|
47 | - new GraphQLField( |
|
48 | - 'allowDonations', |
|
49 | - 'Boolean', |
|
50 | - 'donations', |
|
51 | - esc_html__('Accept Donations?', 'event_espresso') |
|
52 | - ), |
|
53 | - new GraphQLField( |
|
54 | - 'allowOverflow', |
|
55 | - 'Boolean', |
|
56 | - 'allow_overflow', |
|
57 | - esc_html__('Enable Wait List for Event', 'event_espresso') |
|
58 | - ), |
|
59 | - new GraphQLField( |
|
60 | - 'altRegPage', |
|
61 | - 'String', |
|
62 | - 'external_url', |
|
63 | - esc_html__('URL of Event Page if hosted elsewhere', '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 | - 'created', |
|
73 | - 'String', |
|
74 | - 'created', |
|
75 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
76 | - ), |
|
77 | - new GraphQLOutputField( |
|
78 | - 'dbId', |
|
79 | - ['non_null' => 'Int'], |
|
80 | - 'ID', |
|
81 | - esc_html__('The event ID.', 'event_espresso') |
|
82 | - ), |
|
83 | - new GraphQLField( |
|
84 | - 'defaultRegStatus', |
|
85 | - $this->namespace . 'RegistrationStatusEnum', |
|
86 | - 'default_registration_status', |
|
87 | - esc_html__('Default Event Registration Status', 'event_espresso') |
|
88 | - ), |
|
89 | - new GraphQLField( |
|
90 | - 'description', |
|
91 | - 'String', |
|
92 | - 'description', |
|
93 | - esc_html__('Event Description', 'event_espresso') |
|
94 | - ), |
|
95 | - new GraphQLField( |
|
96 | - 'displayDescription', |
|
97 | - 'Boolean', |
|
98 | - 'display_description', |
|
99 | - esc_html__('Display Description Flag', 'event_espresso') |
|
100 | - ), |
|
101 | - new GraphQLField( |
|
102 | - 'displayTicketSelector', |
|
103 | - 'Boolean', |
|
104 | - 'display_ticket_selector', |
|
105 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
106 | - ), |
|
107 | - new GraphQLOutputField( |
|
108 | - 'isActive', |
|
109 | - 'Boolean', |
|
110 | - 'is_active', |
|
111 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
112 | - ), |
|
113 | - new GraphQLOutputField( |
|
114 | - 'isCancelled', |
|
115 | - 'Boolean', |
|
116 | - 'is_cancelled', |
|
117 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
118 | - ), |
|
119 | - new GraphQLOutputField( |
|
120 | - 'isExpired', |
|
121 | - 'Boolean', |
|
122 | - 'is_expired', |
|
123 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
124 | - ), |
|
125 | - new GraphQLOutputField( |
|
126 | - 'isInactive', |
|
127 | - 'Boolean', |
|
128 | - 'is_inactive', |
|
129 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
130 | - ), |
|
131 | - new GraphQLOutputField( |
|
132 | - 'isPostponed', |
|
133 | - 'Boolean', |
|
134 | - 'is_postponed', |
|
135 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
136 | - ), |
|
137 | - new GraphQLOutputField( |
|
138 | - 'isSoldOut', |
|
139 | - 'Boolean', |
|
140 | - 'is_sold_out', |
|
141 | - esc_html__( |
|
142 | - 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
143 | - 'event_espresso' |
|
144 | - ) |
|
145 | - ), |
|
146 | - new GraphQLOutputField( |
|
147 | - 'isUpcoming', |
|
148 | - 'Boolean', |
|
149 | - 'is_upcoming', |
|
150 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLInputField( |
|
153 | - 'manager', |
|
154 | - 'String', |
|
155 | - null, |
|
156 | - esc_html__('Globally unique event ID for the event manager', 'event_espresso') |
|
157 | - ), |
|
158 | - new GraphQLOutputField( |
|
159 | - 'manager', |
|
160 | - 'User', |
|
161 | - null, |
|
162 | - esc_html__('Event Manager', 'event_espresso') |
|
163 | - ), |
|
164 | - new GraphQLField( |
|
165 | - 'maxRegistrations', |
|
166 | - 'Int', |
|
167 | - 'additional_limit', |
|
168 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
169 | - ), |
|
170 | - new GraphQLField( |
|
171 | - 'memberOnly', |
|
172 | - 'Boolean', |
|
173 | - 'member_only', |
|
174 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
175 | - ), |
|
176 | - new GraphQLField( |
|
177 | - 'name', |
|
178 | - 'String', |
|
179 | - 'name', |
|
180 | - esc_html__('Event Name', 'event_espresso') |
|
181 | - ), |
|
182 | - new GraphQLField( |
|
183 | - 'order', |
|
184 | - 'Int', |
|
185 | - 'order', |
|
186 | - esc_html__('Event Menu Order', 'event_espresso') |
|
187 | - ), |
|
188 | - new GraphQLField( |
|
189 | - 'phoneNumber', |
|
190 | - 'String', |
|
191 | - 'phone', |
|
192 | - esc_html__('Event Phone Number', 'event_espresso') |
|
193 | - ), |
|
194 | - new GraphQLField( |
|
195 | - 'shortDescription', |
|
196 | - 'String', |
|
197 | - 'short_description', |
|
198 | - esc_html__('Event Short Description', 'event_espresso') |
|
199 | - ), |
|
200 | - new GraphQLField( |
|
201 | - 'timezoneString', |
|
202 | - 'String', |
|
203 | - 'timezone_string', |
|
204 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
205 | - ), |
|
206 | - new GraphQLField( |
|
207 | - 'visibleOn', |
|
208 | - 'String', |
|
209 | - 'visible_on', |
|
210 | - esc_html__('Event Visible Date', 'event_espresso') |
|
211 | - ), |
|
212 | - new GraphQLField( |
|
213 | - 'venue', |
|
214 | - 'String', |
|
215 | - null, |
|
216 | - esc_html__('Event venue ID', 'event_espresso'), |
|
217 | - null, |
|
218 | - function (EE_Event $source) { |
|
219 | - $venues = $source->venues(); |
|
220 | - /** @var EE_Venue $venue */ |
|
221 | - $venue = reset($venues); |
|
41 | + /** |
|
42 | + * @return GraphQLFieldInterface[] |
|
43 | + */ |
|
44 | + public function getFields(): array |
|
45 | + { |
|
46 | + $fields = [ |
|
47 | + new GraphQLField( |
|
48 | + 'allowDonations', |
|
49 | + 'Boolean', |
|
50 | + 'donations', |
|
51 | + esc_html__('Accept Donations?', 'event_espresso') |
|
52 | + ), |
|
53 | + new GraphQLField( |
|
54 | + 'allowOverflow', |
|
55 | + 'Boolean', |
|
56 | + 'allow_overflow', |
|
57 | + esc_html__('Enable Wait List for Event', 'event_espresso') |
|
58 | + ), |
|
59 | + new GraphQLField( |
|
60 | + 'altRegPage', |
|
61 | + 'String', |
|
62 | + 'external_url', |
|
63 | + esc_html__('URL of Event Page if hosted elsewhere', '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 | + 'created', |
|
73 | + 'String', |
|
74 | + 'created', |
|
75 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
76 | + ), |
|
77 | + new GraphQLOutputField( |
|
78 | + 'dbId', |
|
79 | + ['non_null' => 'Int'], |
|
80 | + 'ID', |
|
81 | + esc_html__('The event ID.', 'event_espresso') |
|
82 | + ), |
|
83 | + new GraphQLField( |
|
84 | + 'defaultRegStatus', |
|
85 | + $this->namespace . 'RegistrationStatusEnum', |
|
86 | + 'default_registration_status', |
|
87 | + esc_html__('Default Event Registration Status', 'event_espresso') |
|
88 | + ), |
|
89 | + new GraphQLField( |
|
90 | + 'description', |
|
91 | + 'String', |
|
92 | + 'description', |
|
93 | + esc_html__('Event Description', 'event_espresso') |
|
94 | + ), |
|
95 | + new GraphQLField( |
|
96 | + 'displayDescription', |
|
97 | + 'Boolean', |
|
98 | + 'display_description', |
|
99 | + esc_html__('Display Description Flag', 'event_espresso') |
|
100 | + ), |
|
101 | + new GraphQLField( |
|
102 | + 'displayTicketSelector', |
|
103 | + 'Boolean', |
|
104 | + 'display_ticket_selector', |
|
105 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
106 | + ), |
|
107 | + new GraphQLOutputField( |
|
108 | + 'isActive', |
|
109 | + 'Boolean', |
|
110 | + 'is_active', |
|
111 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
112 | + ), |
|
113 | + new GraphQLOutputField( |
|
114 | + 'isCancelled', |
|
115 | + 'Boolean', |
|
116 | + 'is_cancelled', |
|
117 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
118 | + ), |
|
119 | + new GraphQLOutputField( |
|
120 | + 'isExpired', |
|
121 | + 'Boolean', |
|
122 | + 'is_expired', |
|
123 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
124 | + ), |
|
125 | + new GraphQLOutputField( |
|
126 | + 'isInactive', |
|
127 | + 'Boolean', |
|
128 | + 'is_inactive', |
|
129 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
130 | + ), |
|
131 | + new GraphQLOutputField( |
|
132 | + 'isPostponed', |
|
133 | + 'Boolean', |
|
134 | + 'is_postponed', |
|
135 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
136 | + ), |
|
137 | + new GraphQLOutputField( |
|
138 | + 'isSoldOut', |
|
139 | + 'Boolean', |
|
140 | + 'is_sold_out', |
|
141 | + esc_html__( |
|
142 | + 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
143 | + 'event_espresso' |
|
144 | + ) |
|
145 | + ), |
|
146 | + new GraphQLOutputField( |
|
147 | + 'isUpcoming', |
|
148 | + 'Boolean', |
|
149 | + 'is_upcoming', |
|
150 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLInputField( |
|
153 | + 'manager', |
|
154 | + 'String', |
|
155 | + null, |
|
156 | + esc_html__('Globally unique event ID for the event manager', 'event_espresso') |
|
157 | + ), |
|
158 | + new GraphQLOutputField( |
|
159 | + 'manager', |
|
160 | + 'User', |
|
161 | + null, |
|
162 | + esc_html__('Event Manager', 'event_espresso') |
|
163 | + ), |
|
164 | + new GraphQLField( |
|
165 | + 'maxRegistrations', |
|
166 | + 'Int', |
|
167 | + 'additional_limit', |
|
168 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
169 | + ), |
|
170 | + new GraphQLField( |
|
171 | + 'memberOnly', |
|
172 | + 'Boolean', |
|
173 | + 'member_only', |
|
174 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
175 | + ), |
|
176 | + new GraphQLField( |
|
177 | + 'name', |
|
178 | + 'String', |
|
179 | + 'name', |
|
180 | + esc_html__('Event Name', 'event_espresso') |
|
181 | + ), |
|
182 | + new GraphQLField( |
|
183 | + 'order', |
|
184 | + 'Int', |
|
185 | + 'order', |
|
186 | + esc_html__('Event Menu Order', 'event_espresso') |
|
187 | + ), |
|
188 | + new GraphQLField( |
|
189 | + 'phoneNumber', |
|
190 | + 'String', |
|
191 | + 'phone', |
|
192 | + esc_html__('Event Phone Number', 'event_espresso') |
|
193 | + ), |
|
194 | + new GraphQLField( |
|
195 | + 'shortDescription', |
|
196 | + 'String', |
|
197 | + 'short_description', |
|
198 | + esc_html__('Event Short Description', 'event_espresso') |
|
199 | + ), |
|
200 | + new GraphQLField( |
|
201 | + 'timezoneString', |
|
202 | + 'String', |
|
203 | + 'timezone_string', |
|
204 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
205 | + ), |
|
206 | + new GraphQLField( |
|
207 | + 'visibleOn', |
|
208 | + 'String', |
|
209 | + 'visible_on', |
|
210 | + esc_html__('Event Visible Date', 'event_espresso') |
|
211 | + ), |
|
212 | + new GraphQLField( |
|
213 | + 'venue', |
|
214 | + 'String', |
|
215 | + null, |
|
216 | + esc_html__('Event venue ID', 'event_espresso'), |
|
217 | + null, |
|
218 | + function (EE_Event $source) { |
|
219 | + $venues = $source->venues(); |
|
220 | + /** @var EE_Venue $venue */ |
|
221 | + $venue = reset($venues); |
|
222 | 222 | |
223 | - return $venue instanceof EE_Venue |
|
224 | - // Since venue is a CPT, $type will be 'post' |
|
225 | - ? Relay::toGlobalId('post', $venue->ID()) |
|
226 | - : null; |
|
227 | - } |
|
228 | - ), |
|
229 | - ]; |
|
223 | + return $venue instanceof EE_Venue |
|
224 | + // Since venue is a CPT, $type will be 'post' |
|
225 | + ? Relay::toGlobalId('post', $venue->ID()) |
|
226 | + : null; |
|
227 | + } |
|
228 | + ), |
|
229 | + ]; |
|
230 | 230 | |
231 | - return apply_filters( |
|
232 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
233 | - $fields, |
|
234 | - $this->name, |
|
235 | - $this->model |
|
236 | - ); |
|
237 | - } |
|
231 | + return apply_filters( |
|
232 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
233 | + $fields, |
|
234 | + $this->name, |
|
235 | + $this->model |
|
236 | + ); |
|
237 | + } |
|
238 | 238 | |
239 | 239 | |
240 | - /** |
|
241 | - * Extends the existing WP GraphQL mutations. |
|
242 | - * |
|
243 | - * @since $VID:$ |
|
244 | - */ |
|
245 | - public function extendMutations() |
|
246 | - { |
|
247 | - add_action( |
|
248 | - 'graphql_post_object_mutation_update_additional_data', |
|
249 | - EventUpdate::mutateFields($this->model, $this), |
|
250 | - 10, |
|
251 | - 6 |
|
252 | - ); |
|
253 | - } |
|
240 | + /** |
|
241 | + * Extends the existing WP GraphQL mutations. |
|
242 | + * |
|
243 | + * @since $VID:$ |
|
244 | + */ |
|
245 | + public function extendMutations() |
|
246 | + { |
|
247 | + add_action( |
|
248 | + 'graphql_post_object_mutation_update_additional_data', |
|
249 | + EventUpdate::mutateFields($this->model, $this), |
|
250 | + 10, |
|
251 | + 6 |
|
252 | + ); |
|
253 | + } |
|
254 | 254 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct(EEM_Event $event_model) |
34 | 34 | { |
35 | - $this->setName($this->namespace . 'Event'); |
|
35 | + $this->setName($this->namespace.'Event'); |
|
36 | 36 | $this->setIsCustomPostType(true); |
37 | 37 | parent::__construct($event_model); |
38 | 38 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ), |
83 | 83 | new GraphQLField( |
84 | 84 | 'defaultRegStatus', |
85 | - $this->namespace . 'RegistrationStatusEnum', |
|
85 | + $this->namespace.'RegistrationStatusEnum', |
|
86 | 86 | 'default_registration_status', |
87 | 87 | esc_html__('Default Event Registration Status', 'event_espresso') |
88 | 88 | ), |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | null, |
216 | 216 | esc_html__('Event venue ID', 'event_espresso'), |
217 | 217 | null, |
218 | - function (EE_Event $source) { |
|
218 | + function(EE_Event $source) { |
|
219 | 219 | $venues = $source->venues(); |
220 | 220 | /** @var EE_Venue $venue */ |
221 | 221 | $venue = reset($venues); |
@@ -14,72 +14,72 @@ |
||
14 | 14 | class EventUpdate extends EntityMutator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Defines the mutation data modification closure. |
|
19 | - * |
|
20 | - * @param EEM_Event $model |
|
21 | - * @param Event $type |
|
22 | - * @return callable |
|
23 | - */ |
|
24 | - public static function mutateFields(EEM_Event $model, Event $type) |
|
25 | - { |
|
26 | - /** |
|
27 | - * Update additional data related to the entity. |
|
28 | - * |
|
29 | - * @param int $id The ID of the postObject being mutated |
|
30 | - * @param array $input The input for the mutation |
|
31 | - * @param WP_Post_Type $post_type_object The Post Type Object for the type of post being mutated |
|
32 | - * @param string $mutation_name The name of the mutation (ex: create, update, delete) |
|
33 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - return static function ( |
|
38 | - int $id, |
|
39 | - array $input, |
|
40 | - WP_Post_Type $post_type_object, |
|
41 | - string $mutation_name, |
|
42 | - AppContext $context, |
|
43 | - ResolveInfo $info |
|
44 | - ) use ( |
|
45 | - $model, |
|
46 | - $type |
|
47 | - ) { |
|
48 | - try { |
|
49 | - // Make sure we are dealing with the right entity. |
|
50 | - if ( |
|
51 | - ! property_exists($post_type_object, 'graphql_single_name') |
|
52 | - || $post_type_object->graphql_single_name !== $type->name() |
|
53 | - ) { |
|
54 | - return; |
|
55 | - } |
|
17 | + /** |
|
18 | + * Defines the mutation data modification closure. |
|
19 | + * |
|
20 | + * @param EEM_Event $model |
|
21 | + * @param Event $type |
|
22 | + * @return callable |
|
23 | + */ |
|
24 | + public static function mutateFields(EEM_Event $model, Event $type) |
|
25 | + { |
|
26 | + /** |
|
27 | + * Update additional data related to the entity. |
|
28 | + * |
|
29 | + * @param int $id The ID of the postObject being mutated |
|
30 | + * @param array $input The input for the mutation |
|
31 | + * @param WP_Post_Type $post_type_object The Post Type Object for the type of post being mutated |
|
32 | + * @param string $mutation_name The name of the mutation (ex: create, update, delete) |
|
33 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + return static function ( |
|
38 | + int $id, |
|
39 | + array $input, |
|
40 | + WP_Post_Type $post_type_object, |
|
41 | + string $mutation_name, |
|
42 | + AppContext $context, |
|
43 | + ResolveInfo $info |
|
44 | + ) use ( |
|
45 | + $model, |
|
46 | + $type |
|
47 | + ) { |
|
48 | + try { |
|
49 | + // Make sure we are dealing with the right entity. |
|
50 | + if ( |
|
51 | + ! property_exists($post_type_object, 'graphql_single_name') |
|
52 | + || $post_type_object->graphql_single_name !== $type->name() |
|
53 | + ) { |
|
54 | + return; |
|
55 | + } |
|
56 | 56 | |
57 | - /** @var EE_Event $entity */ |
|
58 | - $entity = EntityMutator::getEntityFromID($model, $id); |
|
59 | - $args = EventMutation::prepareFields($input); |
|
57 | + /** @var EE_Event $entity */ |
|
58 | + $entity = EntityMutator::getEntityFromID($model, $id); |
|
59 | + $args = EventMutation::prepareFields($input); |
|
60 | 60 | |
61 | - if (isset($args['venue'])) { |
|
62 | - $venue = $args['venue']; |
|
63 | - unset($args['venue']); |
|
64 | - } |
|
61 | + if (isset($args['venue'])) { |
|
62 | + $venue = $args['venue']; |
|
63 | + unset($args['venue']); |
|
64 | + } |
|
65 | 65 | |
66 | - // Update the entity |
|
67 | - $entity->save($args); |
|
66 | + // Update the entity |
|
67 | + $entity->save($args); |
|
68 | 68 | |
69 | - if (isset($venue)) { |
|
70 | - EventMutation::setEventVenue($entity, $venue); |
|
71 | - } |
|
69 | + if (isset($venue)) { |
|
70 | + EventMutation::setEventVenue($entity, $venue); |
|
71 | + } |
|
72 | 72 | |
73 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_event_update', $entity, $input); |
|
74 | - } catch (Exception $exception) { |
|
75 | - EntityMutator::handleExceptions( |
|
76 | - $exception, |
|
77 | - esc_html__( |
|
78 | - 'The event could not be updated because of the following error(s)', |
|
79 | - 'event_espresso' |
|
80 | - ) |
|
81 | - ); |
|
82 | - } |
|
83 | - }; |
|
84 | - } |
|
73 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_event_update', $entity, $input); |
|
74 | + } catch (Exception $exception) { |
|
75 | + EntityMutator::handleExceptions( |
|
76 | + $exception, |
|
77 | + esc_html__( |
|
78 | + 'The event could not be updated because of the following error(s)', |
|
79 | + 'event_espresso' |
|
80 | + ) |
|
81 | + ); |
|
82 | + } |
|
83 | + }; |
|
84 | + } |
|
85 | 85 | } |
@@ -14,63 +14,63 @@ |
||
14 | 14 | class VenueUpdate extends EntityMutator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Defines the mutation data modification closure. |
|
19 | - * |
|
20 | - * @param EEM_Venue $model |
|
21 | - * @param Venue $type |
|
22 | - * @return callable |
|
23 | - */ |
|
24 | - public static function mutateFields(EEM_Venue $model, Venue $type) |
|
25 | - { |
|
26 | - /** |
|
27 | - * Update additional data related to the entity. |
|
28 | - * |
|
29 | - * @param int $id The ID of the postObject being mutated |
|
30 | - * @param array $input The input for the mutation |
|
31 | - * @param WP_Post_Type $post_type_object The Post Type Object for the type of post being mutated |
|
32 | - * @param string $mutation_name The name of the mutation (ex: create, update, delete) |
|
33 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - return static function ( |
|
38 | - int $id, |
|
39 | - array $input, |
|
40 | - WP_Post_Type $post_type_object, |
|
41 | - string $mutation_name, |
|
42 | - AppContext $context, |
|
43 | - ResolveInfo $info |
|
44 | - ) use ( |
|
45 | - $model, |
|
46 | - $type |
|
47 | - ) { |
|
48 | - try { |
|
49 | - // Make sure we are dealing with the right entity. |
|
50 | - if ( |
|
51 | - ! property_exists($post_type_object, 'graphql_single_name') |
|
52 | - || $post_type_object->graphql_single_name !== $type->name() |
|
53 | - ) { |
|
54 | - return; |
|
55 | - } |
|
17 | + /** |
|
18 | + * Defines the mutation data modification closure. |
|
19 | + * |
|
20 | + * @param EEM_Venue $model |
|
21 | + * @param Venue $type |
|
22 | + * @return callable |
|
23 | + */ |
|
24 | + public static function mutateFields(EEM_Venue $model, Venue $type) |
|
25 | + { |
|
26 | + /** |
|
27 | + * Update additional data related to the entity. |
|
28 | + * |
|
29 | + * @param int $id The ID of the postObject being mutated |
|
30 | + * @param array $input The input for the mutation |
|
31 | + * @param WP_Post_Type $post_type_object The Post Type Object for the type of post being mutated |
|
32 | + * @param string $mutation_name The name of the mutation (ex: create, update, delete) |
|
33 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + return static function ( |
|
38 | + int $id, |
|
39 | + array $input, |
|
40 | + WP_Post_Type $post_type_object, |
|
41 | + string $mutation_name, |
|
42 | + AppContext $context, |
|
43 | + ResolveInfo $info |
|
44 | + ) use ( |
|
45 | + $model, |
|
46 | + $type |
|
47 | + ) { |
|
48 | + try { |
|
49 | + // Make sure we are dealing with the right entity. |
|
50 | + if ( |
|
51 | + ! property_exists($post_type_object, 'graphql_single_name') |
|
52 | + || $post_type_object->graphql_single_name !== $type->name() |
|
53 | + ) { |
|
54 | + return; |
|
55 | + } |
|
56 | 56 | |
57 | - /** @var EE_Venue $entity */ |
|
58 | - $entity = EntityMutator::getEntityFromID($model, $id); |
|
59 | - $args = VenueMutation::prepareFields($input); |
|
57 | + /** @var EE_Venue $entity */ |
|
58 | + $entity = EntityMutator::getEntityFromID($model, $id); |
|
59 | + $args = VenueMutation::prepareFields($input); |
|
60 | 60 | |
61 | - // Update the entity |
|
62 | - $entity->save($args); |
|
61 | + // Update the entity |
|
62 | + $entity->save($args); |
|
63 | 63 | |
64 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_venue_update', $entity, $input); |
|
65 | - } catch (Exception $exception) { |
|
66 | - EntityMutator::handleExceptions( |
|
67 | - $exception, |
|
68 | - esc_html__( |
|
69 | - 'The venue could not be updated because of the following error(s)', |
|
70 | - 'event_espresso' |
|
71 | - ) |
|
72 | - ); |
|
73 | - } |
|
74 | - }; |
|
75 | - } |
|
64 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_venue_update', $entity, $input); |
|
65 | + } catch (Exception $exception) { |
|
66 | + EntityMutator::handleExceptions( |
|
67 | + $exception, |
|
68 | + esc_html__( |
|
69 | + 'The venue could not be updated because of the following error(s)', |
|
70 | + 'event_espresso' |
|
71 | + ) |
|
72 | + ); |
|
73 | + } |
|
74 | + }; |
|
75 | + } |
|
76 | 76 | } |