@@ -5,13 +5,13 @@ discard block |
||
| 5 | 5 | class Events extends GraphQLData |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - /** |
|
| 9 | - * @inheritDoc |
|
| 10 | - */ |
|
| 11 | - public function getData(array $where_params = []) |
|
| 12 | - { |
|
| 13 | - $field_key = lcfirst($this->namespace) . 'Events'; |
|
| 14 | - $query = <<<QUERY |
|
| 8 | + /** |
|
| 9 | + * @inheritDoc |
|
| 10 | + */ |
|
| 11 | + public function getData(array $where_params = []) |
|
| 12 | + { |
|
| 13 | + $field_key = lcfirst($this->namespace) . 'Events'; |
|
| 14 | + $query = <<<QUERY |
|
| 15 | 15 | query GET_EVENTS(\$where: {$this->namespace}RootQueryEventsConnectionWhereArgs, \$first: Int, \$last: Int ) { |
| 16 | 16 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
| 17 | 17 | nodes { |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | QUERY; |
| 51 | - $this->setParams( |
|
| 52 | - [ |
|
| 53 | - 'operation_name' => 'GET_EVENTS', |
|
| 54 | - 'variables' => [ |
|
| 55 | - 'first' => 500, |
|
| 56 | - ], |
|
| 57 | - 'query' => $query, |
|
| 58 | - ] |
|
| 59 | - ); |
|
| 60 | - \EEH_Debug_Tools::printr($query, '$query', __FILE__, __LINE__); |
|
| 51 | + $this->setParams( |
|
| 52 | + [ |
|
| 53 | + 'operation_name' => 'GET_EVENTS', |
|
| 54 | + 'variables' => [ |
|
| 55 | + 'first' => 500, |
|
| 56 | + ], |
|
| 57 | + 'query' => $query, |
|
| 58 | + ] |
|
| 59 | + ); |
|
| 60 | + \EEH_Debug_Tools::printr($query, '$query', __FILE__, __LINE__); |
|
| 61 | 61 | |
| 62 | - return $this->getQueryResponse($field_key, $where_params); |
|
| 63 | - } |
|
| 62 | + return $this->getQueryResponse($field_key, $where_params); |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public function getData(array $where_params = []) |
| 12 | 12 | { |
| 13 | - $field_key = lcfirst($this->namespace) . 'Events'; |
|
| 13 | + $field_key = lcfirst($this->namespace).'Events'; |
|
| 14 | 14 | $query = <<<QUERY |
| 15 | 15 | query GET_EVENTS(\$where: {$this->namespace}RootQueryEventsConnectionWhereArgs, \$first: Int, \$last: Int ) { |
| 16 | 16 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
@@ -20,48 +20,48 @@ |
||
| 20 | 20 | class EventEditor extends JsonDataNode |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - const NODE_NAME = 'eventEditor'; |
|
| 23 | + const NODE_NAME = 'eventEditor'; |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var EventEditorGraphQLData |
|
| 28 | - */ |
|
| 29 | - protected $event_editor_gql_data; |
|
| 26 | + /** |
|
| 27 | + * @var EventEditorGraphQLData |
|
| 28 | + */ |
|
| 29 | + protected $event_editor_gql_data; |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * EventEditor JsonDataNode constructor. |
|
| 34 | - * |
|
| 35 | - * @param EventEditorGraphQLData $event_editor_gql_data |
|
| 36 | - * @param JsonDataNodeValidator $validator |
|
| 37 | - */ |
|
| 38 | - public function __construct( |
|
| 39 | - EventEditorGraphQLData $event_editor_gql_data, |
|
| 40 | - JsonDataNodeValidator $validator |
|
| 41 | - ) { |
|
| 42 | - parent::__construct($validator); |
|
| 43 | - $this->event_editor_gql_data = $event_editor_gql_data; |
|
| 44 | - $this->setDomain(EventEditor::NODE_NAME); |
|
| 45 | - $this->setNodeName(EventEditor::NODE_NAME); |
|
| 46 | - } |
|
| 32 | + /** |
|
| 33 | + * EventEditor JsonDataNode constructor. |
|
| 34 | + * |
|
| 35 | + * @param EventEditorGraphQLData $event_editor_gql_data |
|
| 36 | + * @param JsonDataNodeValidator $validator |
|
| 37 | + */ |
|
| 38 | + public function __construct( |
|
| 39 | + EventEditorGraphQLData $event_editor_gql_data, |
|
| 40 | + JsonDataNodeValidator $validator |
|
| 41 | + ) { |
|
| 42 | + parent::__construct($validator); |
|
| 43 | + $this->event_editor_gql_data = $event_editor_gql_data; |
|
| 44 | + $this->setDomain(EventEditor::NODE_NAME); |
|
| 45 | + $this->setNodeName(EventEditor::NODE_NAME); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @throws EE_Error |
|
| 51 | - * @throws ReflectionException |
|
| 52 | - * @since $VID:$ |
|
| 53 | - */ |
|
| 54 | - public function initialize() |
|
| 55 | - { |
|
| 56 | - global $post; |
|
| 57 | - $eventId = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0; |
|
| 58 | - // if there's no event ID but there IS a WP Post... then use the Post ID |
|
| 59 | - $use_post_id = $eventId === 0 && $post instanceof WP_Post && $post->post_type === 'espresso_events'; |
|
| 60 | - $eventId = $use_post_id ? $post->ID : $eventId; |
|
| 61 | - $related_data = $this->event_editor_gql_data->getData($eventId); |
|
| 62 | - foreach ($related_data as $key => $value) { |
|
| 63 | - \EEH_Debug_Tools::printr($value, $key, __FILE__, __LINE__); |
|
| 64 | - $this->addData($key, $value); |
|
| 65 | - } |
|
| 66 | - } |
|
| 49 | + /** |
|
| 50 | + * @throws EE_Error |
|
| 51 | + * @throws ReflectionException |
|
| 52 | + * @since $VID:$ |
|
| 53 | + */ |
|
| 54 | + public function initialize() |
|
| 55 | + { |
|
| 56 | + global $post; |
|
| 57 | + $eventId = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0; |
|
| 58 | + // if there's no event ID but there IS a WP Post... then use the Post ID |
|
| 59 | + $use_post_id = $eventId === 0 && $post instanceof WP_Post && $post->post_type === 'espresso_events'; |
|
| 60 | + $eventId = $use_post_id ? $post->ID : $eventId; |
|
| 61 | + $related_data = $this->event_editor_gql_data->getData($eventId); |
|
| 62 | + foreach ($related_data as $key => $value) { |
|
| 63 | + \EEH_Debug_Tools::printr($value, $key, __FILE__, __LINE__); |
|
| 64 | + $this->addData($key, $value); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -19,211 +19,211 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class GQLRequests extends Route |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @var AssetManifestFactory |
|
| 24 | - */ |
|
| 25 | - private $manifest_factory; |
|
| 22 | + /** |
|
| 23 | + * @var AssetManifestFactory |
|
| 24 | + */ |
|
| 25 | + private $manifest_factory; |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * AssetRequests constructor. |
|
| 30 | - * |
|
| 31 | - * @param EE_Dependency_Map $dependency_map |
|
| 32 | - * @param LoaderInterface $loader |
|
| 33 | - * @param RequestInterface $request |
|
| 34 | - * @param AssetManifestFactory $manifest_factory |
|
| 35 | - */ |
|
| 36 | - public function __construct( |
|
| 37 | - EE_Dependency_Map $dependency_map, |
|
| 38 | - LoaderInterface $loader, |
|
| 39 | - RequestInterface $request, |
|
| 40 | - AssetManifestFactory $manifest_factory |
|
| 41 | - ) { |
|
| 42 | - $this->manifest_factory = $manifest_factory; |
|
| 43 | - parent::__construct($dependency_map, $loader, $request); |
|
| 44 | - } |
|
| 28 | + /** |
|
| 29 | + * AssetRequests constructor. |
|
| 30 | + * |
|
| 31 | + * @param EE_Dependency_Map $dependency_map |
|
| 32 | + * @param LoaderInterface $loader |
|
| 33 | + * @param RequestInterface $request |
|
| 34 | + * @param AssetManifestFactory $manifest_factory |
|
| 35 | + */ |
|
| 36 | + public function __construct( |
|
| 37 | + EE_Dependency_Map $dependency_map, |
|
| 38 | + LoaderInterface $loader, |
|
| 39 | + RequestInterface $request, |
|
| 40 | + AssetManifestFactory $manifest_factory |
|
| 41 | + ) { |
|
| 42 | + $this->manifest_factory = $manifest_factory; |
|
| 43 | + parent::__construct($dependency_map, $loader, $request); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * returns true if the current request matches this route |
|
| 49 | - * |
|
| 50 | - * @return bool |
|
| 51 | - * @since $VID:$ |
|
| 52 | - */ |
|
| 53 | - public function matchesCurrentRequest() |
|
| 54 | - { |
|
| 55 | - global $pagenow; |
|
| 56 | - return ( |
|
| 57 | - $this->request->isGQL() |
|
| 58 | - || $this->request->isUnitTesting() |
|
| 59 | - || ( |
|
| 60 | - $this->request->isAdmin() |
|
| 61 | - && $this->request->getRequestParam('page') === 'espresso_events' |
|
| 62 | - && ( |
|
| 63 | - $this->request->getRequestParam('action') === 'create_new' |
|
| 64 | - || $this->request->getRequestParam('action') === 'edit' |
|
| 65 | - ) |
|
| 66 | - ) |
|
| 67 | - || ( |
|
| 68 | - $pagenow |
|
| 69 | - && ( |
|
| 70 | - $pagenow === 'post-new.php' |
|
| 71 | - || ( |
|
| 72 | - $pagenow === 'post.php' |
|
| 73 | - && $this->request->getRequestParam('action') === 'edit' |
|
| 74 | - ) |
|
| 75 | - ) |
|
| 76 | - ) |
|
| 77 | - ); |
|
| 78 | - } |
|
| 47 | + /** |
|
| 48 | + * returns true if the current request matches this route |
|
| 49 | + * |
|
| 50 | + * @return bool |
|
| 51 | + * @since $VID:$ |
|
| 52 | + */ |
|
| 53 | + public function matchesCurrentRequest() |
|
| 54 | + { |
|
| 55 | + global $pagenow; |
|
| 56 | + return ( |
|
| 57 | + $this->request->isGQL() |
|
| 58 | + || $this->request->isUnitTesting() |
|
| 59 | + || ( |
|
| 60 | + $this->request->isAdmin() |
|
| 61 | + && $this->request->getRequestParam('page') === 'espresso_events' |
|
| 62 | + && ( |
|
| 63 | + $this->request->getRequestParam('action') === 'create_new' |
|
| 64 | + || $this->request->getRequestParam('action') === 'edit' |
|
| 65 | + ) |
|
| 66 | + ) |
|
| 67 | + || ( |
|
| 68 | + $pagenow |
|
| 69 | + && ( |
|
| 70 | + $pagenow === 'post-new.php' |
|
| 71 | + || ( |
|
| 72 | + $pagenow === 'post.php' |
|
| 73 | + && $this->request->getRequestParam('action') === 'edit' |
|
| 74 | + ) |
|
| 75 | + ) |
|
| 76 | + ) |
|
| 77 | + ); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * @since $VID:$ |
|
| 83 | - */ |
|
| 84 | - protected function registerDependencies() |
|
| 85 | - { |
|
| 86 | - $this->dependency_map->registerDependencies( |
|
| 87 | - 'EventEspresso\core\services\graphql\GraphQLManager', |
|
| 88 | - [ |
|
| 89 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 90 | - 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
| 91 | - 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
| 92 | - 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
| 93 | - 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 94 | - ] |
|
| 95 | - ); |
|
| 96 | - $this->dependency_map->registerDependencies( |
|
| 97 | - 'EventEspresso\core\services\graphql\TypesManager', |
|
| 98 | - [ |
|
| 99 | - 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 100 | - ] |
|
| 101 | - ); |
|
| 102 | - $this->dependency_map->registerDependencies( |
|
| 103 | - 'EventEspresso\core\services\graphql\InputsManager', |
|
| 104 | - [ |
|
| 105 | - 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
| 106 | - ] |
|
| 107 | - ); |
|
| 108 | - $this->dependency_map->registerDependencies( |
|
| 109 | - 'EventEspresso\core\services\graphql\EnumsManager', |
|
| 110 | - [ |
|
| 111 | - 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
| 112 | - ] |
|
| 113 | - ); |
|
| 114 | - $this->dependency_map->registerDependencies( |
|
| 115 | - 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
| 116 | - [ |
|
| 117 | - 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 118 | - ] |
|
| 119 | - ); |
|
| 120 | - $this->dependency_map->registerDependencies( |
|
| 121 | - 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
| 122 | - [ |
|
| 123 | - 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
| 124 | - ] |
|
| 125 | - ); |
|
| 126 | - $this->dependency_map->registerDependencies( |
|
| 127 | - 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
| 128 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 129 | - ); |
|
| 130 | - $this->dependency_map->registerDependencies( |
|
| 131 | - 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
| 132 | - ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
| 133 | - ); |
|
| 134 | - $this->dependency_map->registerDependencies( |
|
| 135 | - 'EventEspresso\core\domain\services\graphql\types\Event', |
|
| 136 | - ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
| 137 | - ); |
|
| 138 | - $this->dependency_map->registerDependencies( |
|
| 139 | - 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
| 140 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 141 | - ); |
|
| 142 | - $this->dependency_map->registerDependencies( |
|
| 143 | - 'EventEspresso\core\domain\services\graphql\types\Price', |
|
| 144 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 145 | - ); |
|
| 146 | - $this->dependency_map->registerDependencies( |
|
| 147 | - 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
| 148 | - ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
| 149 | - ); |
|
| 150 | - $this->dependency_map->registerDependencies( |
|
| 151 | - 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
| 152 | - ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
| 153 | - ); |
|
| 154 | - $this->dependency_map->registerDependencies( |
|
| 155 | - 'EventEspresso\core\domain\services\graphql\types\State', |
|
| 156 | - ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
| 157 | - ); |
|
| 158 | - $this->dependency_map->registerDependencies( |
|
| 159 | - 'EventEspresso\core\domain\services\graphql\types\Country', |
|
| 160 | - ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
| 161 | - ); |
|
| 162 | - $this->dependency_map->registerDependencies( |
|
| 163 | - 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
| 164 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 165 | - ); |
|
| 166 | - $this->dependency_map->registerDependencies( |
|
| 167 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryEventsConnection', |
|
| 168 | - ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
| 169 | - ); |
|
| 170 | - $this->dependency_map->registerDependencies( |
|
| 171 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
| 172 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 173 | - ); |
|
| 174 | - $this->dependency_map->registerDependencies( |
|
| 175 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
| 176 | - ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
| 177 | - ); |
|
| 178 | - $this->dependency_map->registerDependencies( |
|
| 179 | - 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
| 180 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 181 | - ); |
|
| 182 | - $this->dependency_map->registerDependencies( |
|
| 183 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
| 184 | - ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 185 | - ); |
|
| 186 | - $this->dependency_map->registerDependencies( |
|
| 187 | - 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
| 188 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 189 | - ); |
|
| 190 | - $this->dependency_map->registerDependencies( |
|
| 191 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
| 192 | - ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 193 | - ); |
|
| 194 | - $this->dependency_map->registerDependencies( |
|
| 195 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
| 196 | - ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
| 197 | - ); |
|
| 198 | - $this->dependency_map->registerDependencies( |
|
| 199 | - 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
| 200 | - ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 201 | - ); |
|
| 202 | - $this->dependency_map->registerDependencies( |
|
| 203 | - 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
| 204 | - ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
| 205 | - ); |
|
| 206 | - } |
|
| 81 | + /** |
|
| 82 | + * @since $VID:$ |
|
| 83 | + */ |
|
| 84 | + protected function registerDependencies() |
|
| 85 | + { |
|
| 86 | + $this->dependency_map->registerDependencies( |
|
| 87 | + 'EventEspresso\core\services\graphql\GraphQLManager', |
|
| 88 | + [ |
|
| 89 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 90 | + 'EventEspresso\core\services\graphql\DataLoaderManager' => EE_Dependency_Map::load_from_cache, |
|
| 91 | + 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
| 92 | + 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
| 93 | + 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 94 | + ] |
|
| 95 | + ); |
|
| 96 | + $this->dependency_map->registerDependencies( |
|
| 97 | + 'EventEspresso\core\services\graphql\TypesManager', |
|
| 98 | + [ |
|
| 99 | + 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 100 | + ] |
|
| 101 | + ); |
|
| 102 | + $this->dependency_map->registerDependencies( |
|
| 103 | + 'EventEspresso\core\services\graphql\InputsManager', |
|
| 104 | + [ |
|
| 105 | + 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
| 106 | + ] |
|
| 107 | + ); |
|
| 108 | + $this->dependency_map->registerDependencies( |
|
| 109 | + 'EventEspresso\core\services\graphql\EnumsManager', |
|
| 110 | + [ |
|
| 111 | + 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
| 112 | + ] |
|
| 113 | + ); |
|
| 114 | + $this->dependency_map->registerDependencies( |
|
| 115 | + 'EventEspresso\core\services\graphql\ConnectionsManager', |
|
| 116 | + [ |
|
| 117 | + 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 118 | + ] |
|
| 119 | + ); |
|
| 120 | + $this->dependency_map->registerDependencies( |
|
| 121 | + 'EventEspresso\core\services\graphql\DataLoaderManager', |
|
| 122 | + [ |
|
| 123 | + 'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache, |
|
| 124 | + ] |
|
| 125 | + ); |
|
| 126 | + $this->dependency_map->registerDependencies( |
|
| 127 | + 'EventEspresso\core\domain\services\graphql\types\Datetime', |
|
| 128 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 129 | + ); |
|
| 130 | + $this->dependency_map->registerDependencies( |
|
| 131 | + 'EventEspresso\core\domain\services\graphql\types\Attendee', |
|
| 132 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
| 133 | + ); |
|
| 134 | + $this->dependency_map->registerDependencies( |
|
| 135 | + 'EventEspresso\core\domain\services\graphql\types\Event', |
|
| 136 | + ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
| 137 | + ); |
|
| 138 | + $this->dependency_map->registerDependencies( |
|
| 139 | + 'EventEspresso\core\domain\services\graphql\types\Ticket', |
|
| 140 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 141 | + ); |
|
| 142 | + $this->dependency_map->registerDependencies( |
|
| 143 | + 'EventEspresso\core\domain\services\graphql\types\Price', |
|
| 144 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 145 | + ); |
|
| 146 | + $this->dependency_map->registerDependencies( |
|
| 147 | + 'EventEspresso\core\domain\services\graphql\types\PriceType', |
|
| 148 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
| 149 | + ); |
|
| 150 | + $this->dependency_map->registerDependencies( |
|
| 151 | + 'EventEspresso\core\domain\services\graphql\types\Venue', |
|
| 152 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
| 153 | + ); |
|
| 154 | + $this->dependency_map->registerDependencies( |
|
| 155 | + 'EventEspresso\core\domain\services\graphql\types\State', |
|
| 156 | + ['EEM_State' => EE_Dependency_Map::load_from_cache] |
|
| 157 | + ); |
|
| 158 | + $this->dependency_map->registerDependencies( |
|
| 159 | + 'EventEspresso\core\domain\services\graphql\types\Country', |
|
| 160 | + ['EEM_Country' => EE_Dependency_Map::load_from_cache] |
|
| 161 | + ); |
|
| 162 | + $this->dependency_map->registerDependencies( |
|
| 163 | + 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection', |
|
| 164 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 165 | + ); |
|
| 166 | + $this->dependency_map->registerDependencies( |
|
| 167 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryEventsConnection', |
|
| 168 | + ['EEM_Event' => EE_Dependency_Map::load_from_cache] |
|
| 169 | + ); |
|
| 170 | + $this->dependency_map->registerDependencies( |
|
| 171 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection', |
|
| 172 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 173 | + ); |
|
| 174 | + $this->dependency_map->registerDependencies( |
|
| 175 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection', |
|
| 176 | + ['EEM_Attendee' => EE_Dependency_Map::load_from_cache] |
|
| 177 | + ); |
|
| 178 | + $this->dependency_map->registerDependencies( |
|
| 179 | + 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection', |
|
| 180 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 181 | + ); |
|
| 182 | + $this->dependency_map->registerDependencies( |
|
| 183 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection', |
|
| 184 | + ['EEM_Ticket' => EE_Dependency_Map::load_from_cache] |
|
| 185 | + ); |
|
| 186 | + $this->dependency_map->registerDependencies( |
|
| 187 | + 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection', |
|
| 188 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 189 | + ); |
|
| 190 | + $this->dependency_map->registerDependencies( |
|
| 191 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection', |
|
| 192 | + ['EEM_Price' => EE_Dependency_Map::load_from_cache] |
|
| 193 | + ); |
|
| 194 | + $this->dependency_map->registerDependencies( |
|
| 195 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection', |
|
| 196 | + ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache] |
|
| 197 | + ); |
|
| 198 | + $this->dependency_map->registerDependencies( |
|
| 199 | + 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection', |
|
| 200 | + ['EEM_Datetime' => EE_Dependency_Map::load_from_cache] |
|
| 201 | + ); |
|
| 202 | + $this->dependency_map->registerDependencies( |
|
| 203 | + 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection', |
|
| 204 | + ['EEM_Venue' => EE_Dependency_Map::load_from_cache] |
|
| 205 | + ); |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | 208 | |
| 209 | - /** |
|
| 210 | - * implements logic required to run during request |
|
| 211 | - * |
|
| 212 | - * @return bool |
|
| 213 | - * @since $VID:$ |
|
| 214 | - */ |
|
| 215 | - protected function requestHandler() |
|
| 216 | - { |
|
| 217 | - if (! class_exists('WPGraphQL')) { |
|
| 218 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
| 219 | - } |
|
| 220 | - // load handler for EE GraphQL requests |
|
| 221 | - $graphQL_manager = $this->loader->getShared( |
|
| 222 | - 'EventEspresso\core\services\graphql\GraphQLManager' |
|
| 223 | - ); |
|
| 224 | - $graphQL_manager->init(); |
|
| 225 | - $manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain()); |
|
| 226 | - $manifest->initialize(); |
|
| 227 | - return true; |
|
| 228 | - } |
|
| 209 | + /** |
|
| 210 | + * implements logic required to run during request |
|
| 211 | + * |
|
| 212 | + * @return bool |
|
| 213 | + * @since $VID:$ |
|
| 214 | + */ |
|
| 215 | + protected function requestHandler() |
|
| 216 | + { |
|
| 217 | + if (! class_exists('WPGraphQL')) { |
|
| 218 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
| 219 | + } |
|
| 220 | + // load handler for EE GraphQL requests |
|
| 221 | + $graphQL_manager = $this->loader->getShared( |
|
| 222 | + 'EventEspresso\core\services\graphql\GraphQLManager' |
|
| 223 | + ); |
|
| 224 | + $graphQL_manager->init(); |
|
| 225 | + $manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain()); |
|
| 226 | + $manifest->initialize(); |
|
| 227 | + return true; |
|
| 228 | + } |
|
| 229 | 229 | } |
@@ -18,130 +18,130 @@ |
||
| 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() |
|
| 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() |
|
| 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 | - $this->dependency_map->registerDependencies( |
|
| 44 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData', |
|
| 45 | - [ |
|
| 46 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache, |
|
| 47 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Events' => EE_Dependency_Map::load_from_cache, |
|
| 48 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache, |
|
| 49 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache, |
|
| 50 | - 'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache, |
|
| 51 | - 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache, |
|
| 52 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache, |
|
| 53 | - ] |
|
| 54 | - ); |
|
| 55 | - $this->dependency_map->registerDependencies( |
|
| 56 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations', |
|
| 57 | - [ |
|
| 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 | - ); |
|
| 66 | - $this->dependency_map->registerDependencies( |
|
| 67 | - 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities', |
|
| 68 | - [ |
|
| 69 | - 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache, |
|
| 70 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 71 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 72 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 73 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 74 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 75 | - 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
| 76 | - ] |
|
| 77 | - ); |
|
| 78 | - $this->dependency_map->registerDependencies( |
|
| 79 | - 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes', |
|
| 80 | - [ |
|
| 81 | - 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache, |
|
| 82 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 83 | - ] |
|
| 84 | - ); |
|
| 85 | - $this->dependency_map->registerDependencies( |
|
| 86 | - 'EventEspresso\core\domain\services\admin\entities\DefaultTickets', |
|
| 87 | - [ |
|
| 88 | - 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache, |
|
| 89 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 90 | - ] |
|
| 91 | - ); |
|
| 92 | - $this->dependency_map->registerDependencies( |
|
| 93 | - 'EventEspresso\core\domain\services\admin\entities\DefaultPrices', |
|
| 94 | - [ |
|
| 95 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 96 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 97 | - ] |
|
| 98 | - ); |
|
| 99 | - $this->dependency_map->registerDependencies( |
|
| 100 | - 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor', |
|
| 101 | - [ |
|
| 102 | - 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache, |
|
| 103 | - 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
| 104 | - ] |
|
| 105 | - ); |
|
| 106 | - $this->dependency_map->registerDependencies( |
|
| 107 | - 'EventEspresso\core\domain\services\assets\EventEditorAssetManager', |
|
| 108 | - [ |
|
| 109 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 110 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 111 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 112 | - ] |
|
| 113 | - ); |
|
| 114 | - $this->loader->getShared( |
|
| 115 | - 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData' |
|
| 116 | - ); |
|
| 117 | - /** @var EventEditor $data_node */ |
|
| 118 | - $data_node = $this->loader->getShared( |
|
| 119 | - 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' |
|
| 120 | - ); |
|
| 121 | - $this->setDataNode($data_node); |
|
| 122 | - } |
|
| 38 | + /** |
|
| 39 | + * @since $VID:$ |
|
| 40 | + */ |
|
| 41 | + protected function registerDependencies() |
|
| 42 | + { |
|
| 43 | + $this->dependency_map->registerDependencies( |
|
| 44 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData', |
|
| 45 | + [ |
|
| 46 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache, |
|
| 47 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Events' => EE_Dependency_Map::load_from_cache, |
|
| 48 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache, |
|
| 49 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache, |
|
| 50 | + 'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache, |
|
| 51 | + 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache, |
|
| 52 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache, |
|
| 53 | + ] |
|
| 54 | + ); |
|
| 55 | + $this->dependency_map->registerDependencies( |
|
| 56 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations', |
|
| 57 | + [ |
|
| 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 | + ); |
|
| 66 | + $this->dependency_map->registerDependencies( |
|
| 67 | + 'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities', |
|
| 68 | + [ |
|
| 69 | + 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache, |
|
| 70 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 71 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 72 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 73 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 74 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 75 | + 'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache, |
|
| 76 | + ] |
|
| 77 | + ); |
|
| 78 | + $this->dependency_map->registerDependencies( |
|
| 79 | + 'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes', |
|
| 80 | + [ |
|
| 81 | + 'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache, |
|
| 82 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 83 | + ] |
|
| 84 | + ); |
|
| 85 | + $this->dependency_map->registerDependencies( |
|
| 86 | + 'EventEspresso\core\domain\services\admin\entities\DefaultTickets', |
|
| 87 | + [ |
|
| 88 | + 'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache, |
|
| 89 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 90 | + ] |
|
| 91 | + ); |
|
| 92 | + $this->dependency_map->registerDependencies( |
|
| 93 | + 'EventEspresso\core\domain\services\admin\entities\DefaultPrices', |
|
| 94 | + [ |
|
| 95 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 96 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 97 | + ] |
|
| 98 | + ); |
|
| 99 | + $this->dependency_map->registerDependencies( |
|
| 100 | + 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor', |
|
| 101 | + [ |
|
| 102 | + 'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache, |
|
| 103 | + 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
|
| 104 | + ] |
|
| 105 | + ); |
|
| 106 | + $this->dependency_map->registerDependencies( |
|
| 107 | + 'EventEspresso\core\domain\services\assets\EventEditorAssetManager', |
|
| 108 | + [ |
|
| 109 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 110 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 111 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 112 | + ] |
|
| 113 | + ); |
|
| 114 | + $this->loader->getShared( |
|
| 115 | + 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData' |
|
| 116 | + ); |
|
| 117 | + /** @var EventEditor $data_node */ |
|
| 118 | + $data_node = $this->loader->getShared( |
|
| 119 | + 'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' |
|
| 120 | + ); |
|
| 121 | + $this->setDataNode($data_node); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * implements logic required to run during request |
|
| 127 | - * |
|
| 128 | - * @return bool |
|
| 129 | - * @since $VID:$ |
|
| 130 | - */ |
|
| 131 | - protected function requestHandler() |
|
| 132 | - { |
|
| 133 | - if (! class_exists('WPGraphQL')) { |
|
| 134 | - require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
| 135 | - } |
|
| 136 | - /** @var GraphQLManager $graphQL_manager */ |
|
| 137 | - $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager'); |
|
| 138 | - $graphQL_manager->init(); |
|
| 125 | + /** |
|
| 126 | + * implements logic required to run during request |
|
| 127 | + * |
|
| 128 | + * @return bool |
|
| 129 | + * @since $VID:$ |
|
| 130 | + */ |
|
| 131 | + protected function requestHandler() |
|
| 132 | + { |
|
| 133 | + if (! class_exists('WPGraphQL')) { |
|
| 134 | + require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php'; |
|
| 135 | + } |
|
| 136 | + /** @var GraphQLManager $graphQL_manager */ |
|
| 137 | + $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager'); |
|
| 138 | + $graphQL_manager->init(); |
|
| 139 | 139 | |
| 140 | - /** @var EventEditorAssetManager $asset_manager */ |
|
| 141 | - $asset_manager = $this->loader->getShared( |
|
| 142 | - 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' |
|
| 143 | - ); |
|
| 144 | - add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']); |
|
| 145 | - return true; |
|
| 146 | - } |
|
| 140 | + /** @var EventEditorAssetManager $asset_manager */ |
|
| 141 | + $asset_manager = $this->loader->getShared( |
|
| 142 | + 'EventEspresso\core\domain\services\assets\EventEditorAssetManager' |
|
| 143 | + ); |
|
| 144 | + add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']); |
|
| 145 | + return true; |
|
| 146 | + } |
|
| 147 | 147 | } |
@@ -21,119 +21,119 @@ |
||
| 21 | 21 | class EventEditorGraphQLData |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var Events $events |
|
| 26 | - */ |
|
| 27 | - protected $events; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var Datetimes $datetimes |
|
| 31 | - */ |
|
| 32 | - protected $datetimes; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var Prices $prices |
|
| 36 | - */ |
|
| 37 | - protected $prices; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var PriceTypes $price_types |
|
| 41 | - */ |
|
| 42 | - protected $price_types; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @var Tickets $tickets |
|
| 46 | - */ |
|
| 47 | - protected $tickets; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @var EventEntityRelations $relations |
|
| 51 | - */ |
|
| 52 | - protected $relations; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @var NewEventDefaultEntities $default_entities |
|
| 56 | - */ |
|
| 57 | - protected $default_entities; |
|
| 58 | - |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * EventEditorGraphQLData constructor. |
|
| 62 | - * |
|
| 63 | - * @param Datetimes $datetimes |
|
| 64 | - * @param Events $events |
|
| 65 | - * @param Prices $prices |
|
| 66 | - * @param PriceTypes $price_types |
|
| 67 | - * @param Tickets $tickets |
|
| 68 | - * @param EventEntityRelations $relations |
|
| 69 | - * @param NewEventDefaultEntities $default_entities |
|
| 70 | - */ |
|
| 71 | - public function __construct( |
|
| 72 | - Datetimes $datetimes, |
|
| 73 | - Events $events, |
|
| 74 | - Prices $prices, |
|
| 75 | - PriceTypes $price_types, |
|
| 76 | - Tickets $tickets, |
|
| 77 | - EventEntityRelations $relations, |
|
| 78 | - NewEventDefaultEntities $default_entities |
|
| 79 | - ) { |
|
| 80 | - $this->datetimes = $datetimes; |
|
| 81 | - $this->events = $events; |
|
| 82 | - $this->default_entities = $default_entities; |
|
| 83 | - $this->prices = $prices; |
|
| 84 | - $this->price_types = $price_types; |
|
| 85 | - $this->relations = $relations; |
|
| 86 | - $this->tickets = $tickets; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @param int $eventId |
|
| 92 | - * @return array |
|
| 93 | - * @throws EE_Error |
|
| 94 | - * @throws ReflectionException |
|
| 95 | - * @since $VID:$ |
|
| 96 | - */ |
|
| 97 | - public function getData(int $eventId) |
|
| 98 | - { |
|
| 99 | - \EEH_Debug_Tools::printr($eventId, '$eventId', __FILE__, __LINE__); |
|
| 100 | - $event = $this->events->getData(['eventId' => $eventId]); |
|
| 101 | - \EEH_Debug_Tools::printr($event, '$event', __FILE__, __LINE__); |
|
| 102 | - $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
| 103 | - |
|
| 104 | - // Avoid undefined variable warning in PHP >= 7.3 |
|
| 105 | - $tickets = null; |
|
| 106 | - $prices = null; |
|
| 107 | - |
|
| 108 | - if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) { |
|
| 109 | - $this->default_entities->getData($eventId); |
|
| 110 | - $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - if (! empty($datetimes['nodes'])) { |
|
| 114 | - $datetimeIn = wp_list_pluck($datetimes['nodes'], 'id'); |
|
| 115 | - |
|
| 116 | - if (! empty($datetimeIn)) { |
|
| 117 | - $tickets = $this->tickets->getData(['datetimeIn' => $datetimeIn]); |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - if (! empty($tickets['nodes'])) { |
|
| 122 | - $ticketIn = wp_list_pluck($tickets['nodes'], 'id'); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - $pricesArgs = ['includeDefaultPrices' => true]; |
|
| 126 | - |
|
| 127 | - if (! empty($ticketIn)) { |
|
| 128 | - $pricesArgs['ticketIn'] = $ticketIn; |
|
| 129 | - } |
|
| 130 | - $prices = $this->prices->getData($pricesArgs); |
|
| 131 | - |
|
| 132 | - $priceTypes = $this->price_types->getData(); |
|
| 133 | - |
|
| 134 | - $relations = $this->relations->getData($eventId); |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - return compact('event', 'datetimes', 'tickets', 'prices', 'priceTypes', 'relations'); |
|
| 138 | - } |
|
| 24 | + /** |
|
| 25 | + * @var Events $events |
|
| 26 | + */ |
|
| 27 | + protected $events; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var Datetimes $datetimes |
|
| 31 | + */ |
|
| 32 | + protected $datetimes; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var Prices $prices |
|
| 36 | + */ |
|
| 37 | + protected $prices; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var PriceTypes $price_types |
|
| 41 | + */ |
|
| 42 | + protected $price_types; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @var Tickets $tickets |
|
| 46 | + */ |
|
| 47 | + protected $tickets; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @var EventEntityRelations $relations |
|
| 51 | + */ |
|
| 52 | + protected $relations; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @var NewEventDefaultEntities $default_entities |
|
| 56 | + */ |
|
| 57 | + protected $default_entities; |
|
| 58 | + |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * EventEditorGraphQLData constructor. |
|
| 62 | + * |
|
| 63 | + * @param Datetimes $datetimes |
|
| 64 | + * @param Events $events |
|
| 65 | + * @param Prices $prices |
|
| 66 | + * @param PriceTypes $price_types |
|
| 67 | + * @param Tickets $tickets |
|
| 68 | + * @param EventEntityRelations $relations |
|
| 69 | + * @param NewEventDefaultEntities $default_entities |
|
| 70 | + */ |
|
| 71 | + public function __construct( |
|
| 72 | + Datetimes $datetimes, |
|
| 73 | + Events $events, |
|
| 74 | + Prices $prices, |
|
| 75 | + PriceTypes $price_types, |
|
| 76 | + Tickets $tickets, |
|
| 77 | + EventEntityRelations $relations, |
|
| 78 | + NewEventDefaultEntities $default_entities |
|
| 79 | + ) { |
|
| 80 | + $this->datetimes = $datetimes; |
|
| 81 | + $this->events = $events; |
|
| 82 | + $this->default_entities = $default_entities; |
|
| 83 | + $this->prices = $prices; |
|
| 84 | + $this->price_types = $price_types; |
|
| 85 | + $this->relations = $relations; |
|
| 86 | + $this->tickets = $tickets; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @param int $eventId |
|
| 92 | + * @return array |
|
| 93 | + * @throws EE_Error |
|
| 94 | + * @throws ReflectionException |
|
| 95 | + * @since $VID:$ |
|
| 96 | + */ |
|
| 97 | + public function getData(int $eventId) |
|
| 98 | + { |
|
| 99 | + \EEH_Debug_Tools::printr($eventId, '$eventId', __FILE__, __LINE__); |
|
| 100 | + $event = $this->events->getData(['eventId' => $eventId]); |
|
| 101 | + \EEH_Debug_Tools::printr($event, '$event', __FILE__, __LINE__); |
|
| 102 | + $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
| 103 | + |
|
| 104 | + // Avoid undefined variable warning in PHP >= 7.3 |
|
| 105 | + $tickets = null; |
|
| 106 | + $prices = null; |
|
| 107 | + |
|
| 108 | + if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) { |
|
| 109 | + $this->default_entities->getData($eventId); |
|
| 110 | + $datetimes = $this->datetimes->getData(['eventId' => $eventId]); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + if (! empty($datetimes['nodes'])) { |
|
| 114 | + $datetimeIn = wp_list_pluck($datetimes['nodes'], 'id'); |
|
| 115 | + |
|
| 116 | + if (! empty($datetimeIn)) { |
|
| 117 | + $tickets = $this->tickets->getData(['datetimeIn' => $datetimeIn]); |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + if (! empty($tickets['nodes'])) { |
|
| 122 | + $ticketIn = wp_list_pluck($tickets['nodes'], 'id'); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + $pricesArgs = ['includeDefaultPrices' => true]; |
|
| 126 | + |
|
| 127 | + if (! empty($ticketIn)) { |
|
| 128 | + $pricesArgs['ticketIn'] = $ticketIn; |
|
| 129 | + } |
|
| 130 | + $prices = $this->prices->getData($pricesArgs); |
|
| 131 | + |
|
| 132 | + $priceTypes = $this->price_types->getData(); |
|
| 133 | + |
|
| 134 | + $relations = $this->relations->getData($eventId); |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + return compact('event', 'datetimes', 'tickets', 'prices', 'priceTypes', 'relations'); |
|
| 138 | + } |
|
| 139 | 139 | } |
@@ -11,102 +11,102 @@ |
||
| 11 | 11 | class VenueMutation |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Maps the GraphQL input to a format that the model functions can use |
|
| 16 | - * |
|
| 17 | - * @param array $input Data coming from the GraphQL mutation query input |
|
| 18 | - * @param string $mutation_name Name of the mutation being performed |
|
| 19 | - * @return array |
|
| 20 | - */ |
|
| 21 | - public static function prepareFields(array $input, $mutation_name) |
|
| 22 | - { |
|
| 23 | - |
|
| 24 | - $args = []; |
|
| 25 | - |
|
| 26 | - if (! empty($input['name'])) { |
|
| 27 | - $args['VNU_name'] = sanitize_text_field($input['name']); |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - if (! empty($input['description'])) { |
|
| 31 | - $args['VNU_desc'] = wp_kses_post($input['description']); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - if (! empty($input['shortDescription'])) { |
|
| 35 | - $args['VNU_short_desc'] = sanitize_text_field($input['shortDescription']); |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - if (! empty($input['identifier'])) { |
|
| 39 | - $args['VNU_identifier'] = sanitize_title($input['identifier']); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - if (! empty($input['created'])) { |
|
| 43 | - $args['VNU_created'] = new DateTime(sanitize_text_field($input['created'])); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - if (! empty($input['order'])) { |
|
| 47 | - $args['VNU_order'] = absint($input['order']); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - if (! empty($input['wpUser'])) { |
|
| 51 | - $args['VNU_wp_user'] = absint($input['wpUser']); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - if (! empty($input['address'])) { |
|
| 55 | - $args['VNU_address'] = sanitize_text_field($input['address']); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if (! empty($input['address2'])) { |
|
| 59 | - $args['VNU_address2'] = sanitize_text_field($input['address2']); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - if (! empty($input['city'])) { |
|
| 63 | - $args['VNU_city'] = sanitize_text_field($input['city']); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - if (! empty($input['state'])) { |
|
| 67 | - $args['STA_ID'] = absint($input['state']); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if (! empty($input['country'])) { |
|
| 71 | - $args['CNT_ISO'] = sanitize_text_field($input['country']); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - if (! empty($input['zip'])) { |
|
| 75 | - $args['VNU_zip'] = sanitize_text_field($input['zip']); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if (! empty($input['capacity'])) { |
|
| 79 | - $args['VNU_capacity'] = absint($input['capacity']); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - if (! empty($input['phone'])) { |
|
| 83 | - $args['VNU_phone'] = sanitize_text_field($input['phone']); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - if (! empty($input['virtualPhone'])) { |
|
| 87 | - $args['VNU_virtual_phone'] = sanitize_text_field($input['virtualPhone']); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - if (! empty($input['url'])) { |
|
| 91 | - $args['VNU_url'] = sanitize_text_field($input['url']); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - if (! empty($input['virtualUrl'])) { |
|
| 95 | - $args['VNU_virtual_url'] = sanitize_text_field($input['virtualUrl']); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - if (! empty($input['googleMapLink'])) { |
|
| 99 | - $args['VNU_google_map_link'] = sanitize_text_field($input['googleMapLink']); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if (! empty($input['enableForGmap'])) { |
|
| 103 | - $args['VNU_enable_for_gmap'] = (bool) $input['enableForGmap']; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - return apply_filters( |
|
| 107 | - 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__venue_args', |
|
| 108 | - $args, |
|
| 109 | - $input |
|
| 110 | - ); |
|
| 111 | - } |
|
| 14 | + /** |
|
| 15 | + * Maps the GraphQL input to a format that the model functions can use |
|
| 16 | + * |
|
| 17 | + * @param array $input Data coming from the GraphQL mutation query input |
|
| 18 | + * @param string $mutation_name Name of the mutation being performed |
|
| 19 | + * @return array |
|
| 20 | + */ |
|
| 21 | + public static function prepareFields(array $input, $mutation_name) |
|
| 22 | + { |
|
| 23 | + |
|
| 24 | + $args = []; |
|
| 25 | + |
|
| 26 | + if (! empty($input['name'])) { |
|
| 27 | + $args['VNU_name'] = sanitize_text_field($input['name']); |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + if (! empty($input['description'])) { |
|
| 31 | + $args['VNU_desc'] = wp_kses_post($input['description']); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + if (! empty($input['shortDescription'])) { |
|
| 35 | + $args['VNU_short_desc'] = sanitize_text_field($input['shortDescription']); |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + if (! empty($input['identifier'])) { |
|
| 39 | + $args['VNU_identifier'] = sanitize_title($input['identifier']); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + if (! empty($input['created'])) { |
|
| 43 | + $args['VNU_created'] = new DateTime(sanitize_text_field($input['created'])); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + if (! empty($input['order'])) { |
|
| 47 | + $args['VNU_order'] = absint($input['order']); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + if (! empty($input['wpUser'])) { |
|
| 51 | + $args['VNU_wp_user'] = absint($input['wpUser']); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + if (! empty($input['address'])) { |
|
| 55 | + $args['VNU_address'] = sanitize_text_field($input['address']); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if (! empty($input['address2'])) { |
|
| 59 | + $args['VNU_address2'] = sanitize_text_field($input['address2']); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + if (! empty($input['city'])) { |
|
| 63 | + $args['VNU_city'] = sanitize_text_field($input['city']); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + if (! empty($input['state'])) { |
|
| 67 | + $args['STA_ID'] = absint($input['state']); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if (! empty($input['country'])) { |
|
| 71 | + $args['CNT_ISO'] = sanitize_text_field($input['country']); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + if (! empty($input['zip'])) { |
|
| 75 | + $args['VNU_zip'] = sanitize_text_field($input['zip']); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if (! empty($input['capacity'])) { |
|
| 79 | + $args['VNU_capacity'] = absint($input['capacity']); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + if (! empty($input['phone'])) { |
|
| 83 | + $args['VNU_phone'] = sanitize_text_field($input['phone']); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + if (! empty($input['virtualPhone'])) { |
|
| 87 | + $args['VNU_virtual_phone'] = sanitize_text_field($input['virtualPhone']); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + if (! empty($input['url'])) { |
|
| 91 | + $args['VNU_url'] = sanitize_text_field($input['url']); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + if (! empty($input['virtualUrl'])) { |
|
| 95 | + $args['VNU_virtual_url'] = sanitize_text_field($input['virtualUrl']); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + if (! empty($input['googleMapLink'])) { |
|
| 99 | + $args['VNU_google_map_link'] = sanitize_text_field($input['googleMapLink']); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if (! empty($input['enableForGmap'])) { |
|
| 103 | + $args['VNU_enable_for_gmap'] = (bool) $input['enableForGmap']; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + return apply_filters( |
|
| 107 | + 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__venue_args', |
|
| 108 | + $args, |
|
| 109 | + $input |
|
| 110 | + ); |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -23,83 +23,83 @@ |
||
| 23 | 23 | |
| 24 | 24 | $args = []; |
| 25 | 25 | |
| 26 | - if (! empty($input['name'])) { |
|
| 26 | + if ( ! empty($input['name'])) { |
|
| 27 | 27 | $args['VNU_name'] = sanitize_text_field($input['name']); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if (! empty($input['description'])) { |
|
| 30 | + if ( ! empty($input['description'])) { |
|
| 31 | 31 | $args['VNU_desc'] = wp_kses_post($input['description']); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if (! empty($input['shortDescription'])) { |
|
| 34 | + if ( ! empty($input['shortDescription'])) { |
|
| 35 | 35 | $args['VNU_short_desc'] = sanitize_text_field($input['shortDescription']); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if (! empty($input['identifier'])) { |
|
| 38 | + if ( ! empty($input['identifier'])) { |
|
| 39 | 39 | $args['VNU_identifier'] = sanitize_title($input['identifier']); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if (! empty($input['created'])) { |
|
| 42 | + if ( ! empty($input['created'])) { |
|
| 43 | 43 | $args['VNU_created'] = new DateTime(sanitize_text_field($input['created'])); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if (! empty($input['order'])) { |
|
| 46 | + if ( ! empty($input['order'])) { |
|
| 47 | 47 | $args['VNU_order'] = absint($input['order']); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (! empty($input['wpUser'])) { |
|
| 50 | + if ( ! empty($input['wpUser'])) { |
|
| 51 | 51 | $args['VNU_wp_user'] = absint($input['wpUser']); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if (! empty($input['address'])) { |
|
| 54 | + if ( ! empty($input['address'])) { |
|
| 55 | 55 | $args['VNU_address'] = sanitize_text_field($input['address']); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if (! empty($input['address2'])) { |
|
| 58 | + if ( ! empty($input['address2'])) { |
|
| 59 | 59 | $args['VNU_address2'] = sanitize_text_field($input['address2']); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (! empty($input['city'])) { |
|
| 62 | + if ( ! empty($input['city'])) { |
|
| 63 | 63 | $args['VNU_city'] = sanitize_text_field($input['city']); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (! empty($input['state'])) { |
|
| 66 | + if ( ! empty($input['state'])) { |
|
| 67 | 67 | $args['STA_ID'] = absint($input['state']); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (! empty($input['country'])) { |
|
| 70 | + if ( ! empty($input['country'])) { |
|
| 71 | 71 | $args['CNT_ISO'] = sanitize_text_field($input['country']); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (! empty($input['zip'])) { |
|
| 74 | + if ( ! empty($input['zip'])) { |
|
| 75 | 75 | $args['VNU_zip'] = sanitize_text_field($input['zip']); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if (! empty($input['capacity'])) { |
|
| 78 | + if ( ! empty($input['capacity'])) { |
|
| 79 | 79 | $args['VNU_capacity'] = absint($input['capacity']); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if (! empty($input['phone'])) { |
|
| 82 | + if ( ! empty($input['phone'])) { |
|
| 83 | 83 | $args['VNU_phone'] = sanitize_text_field($input['phone']); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (! empty($input['virtualPhone'])) { |
|
| 86 | + if ( ! empty($input['virtualPhone'])) { |
|
| 87 | 87 | $args['VNU_virtual_phone'] = sanitize_text_field($input['virtualPhone']); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if (! empty($input['url'])) { |
|
| 90 | + if ( ! empty($input['url'])) { |
|
| 91 | 91 | $args['VNU_url'] = sanitize_text_field($input['url']); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (! empty($input['virtualUrl'])) { |
|
| 94 | + if ( ! empty($input['virtualUrl'])) { |
|
| 95 | 95 | $args['VNU_virtual_url'] = sanitize_text_field($input['virtualUrl']); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (! empty($input['googleMapLink'])) { |
|
| 98 | + if ( ! empty($input['googleMapLink'])) { |
|
| 99 | 99 | $args['VNU_google_map_link'] = sanitize_text_field($input['googleMapLink']); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if (! empty($input['enableForGmap'])) { |
|
| 102 | + if ( ! empty($input['enableForGmap'])) { |
|
| 103 | 103 | $args['VNU_enable_for_gmap'] = (bool) $input['enableForGmap']; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -14,82 +14,82 @@ |
||
| 14 | 14 | class EventMutation |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Maps the GraphQL input to a format that the model functions can use |
|
| 19 | - * |
|
| 20 | - * @param array $input Data coming from the GraphQL mutation query input |
|
| 21 | - * @param string $mutation_name Name of the mutation being performed |
|
| 22 | - * @return array |
|
| 23 | - * @throws Exception |
|
| 24 | - */ |
|
| 25 | - public static function prepareFields(array $input, $mutation_name) |
|
| 26 | - { |
|
| 27 | - $args = []; |
|
| 28 | - |
|
| 29 | - if (! empty($input['additionalLimit'])) { |
|
| 30 | - $args['EVT_additional_limit'] = absint($input['additionalLimit']); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - if (array_key_exists('allowOverflow', $input)) { |
|
| 34 | - $args['EVT_allow_overflow'] = (bool) ($input['allowOverflow']); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - if (! empty($input['description'])) { |
|
| 38 | - $args['EVT_desc'] = wp_kses_post($input['description']); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - if (array_key_exists('displayDescription', $input)) { |
|
| 42 | - $args['EVT_display_desc'] = (bool) ($input['displayDescription']); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if (array_key_exists('displayTicketSelector', $input)) { |
|
| 46 | - $args['EVT_display_ticket_selector'] = (bool) ($input['displayTicketSelector']); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - if (array_key_exists('donations', $input)) { |
|
| 50 | - $args['EVT_donations'] = (bool) ($input['donations']); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - if (! empty($input['externalUrl'])) { |
|
| 54 | - $args['EVT_external_URL'] = sanitize_text_field($input['externalUrl']); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - if (array_key_exists('memberOnly', $input)) { |
|
| 58 | - $args['EVT_member_only'] = (bool) ($input['memberOnly']); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - if (! empty($input['name'])) { |
|
| 62 | - $args['EVT_name'] = sanitize_text_field($input['name']); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - if (! empty($input['order'])) { |
|
| 66 | - $args['EVT_order'] = absint($input['order']); |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - if (! empty($input['phone'])) { |
|
| 70 | - $args['EVT_phone'] = sanitize_text_field($input['phone']); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - if (! empty($input['shortDescription'])) { |
|
| 74 | - $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db'); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - if (! empty($input['timezoneString'])) { |
|
| 78 | - $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - if (! empty($input['visibleOn'])) { |
|
| 82 | - $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - if (! empty($input['wpUser'])) { |
|
| 86 | - $args['EVT_wp_user'] = absint($input['wpUser']); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - return apply_filters( |
|
| 90 | - 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args', |
|
| 91 | - $args, |
|
| 92 | - $input |
|
| 93 | - ); |
|
| 94 | - } |
|
| 17 | + /** |
|
| 18 | + * Maps the GraphQL input to a format that the model functions can use |
|
| 19 | + * |
|
| 20 | + * @param array $input Data coming from the GraphQL mutation query input |
|
| 21 | + * @param string $mutation_name Name of the mutation being performed |
|
| 22 | + * @return array |
|
| 23 | + * @throws Exception |
|
| 24 | + */ |
|
| 25 | + public static function prepareFields(array $input, $mutation_name) |
|
| 26 | + { |
|
| 27 | + $args = []; |
|
| 28 | + |
|
| 29 | + if (! empty($input['additionalLimit'])) { |
|
| 30 | + $args['EVT_additional_limit'] = absint($input['additionalLimit']); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + if (array_key_exists('allowOverflow', $input)) { |
|
| 34 | + $args['EVT_allow_overflow'] = (bool) ($input['allowOverflow']); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + if (! empty($input['description'])) { |
|
| 38 | + $args['EVT_desc'] = wp_kses_post($input['description']); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if (array_key_exists('displayDescription', $input)) { |
|
| 42 | + $args['EVT_display_desc'] = (bool) ($input['displayDescription']); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if (array_key_exists('displayTicketSelector', $input)) { |
|
| 46 | + $args['EVT_display_ticket_selector'] = (bool) ($input['displayTicketSelector']); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if (array_key_exists('donations', $input)) { |
|
| 50 | + $args['EVT_donations'] = (bool) ($input['donations']); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + if (! empty($input['externalUrl'])) { |
|
| 54 | + $args['EVT_external_URL'] = sanitize_text_field($input['externalUrl']); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + if (array_key_exists('memberOnly', $input)) { |
|
| 58 | + $args['EVT_member_only'] = (bool) ($input['memberOnly']); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + if (! empty($input['name'])) { |
|
| 62 | + $args['EVT_name'] = sanitize_text_field($input['name']); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + if (! empty($input['order'])) { |
|
| 66 | + $args['EVT_order'] = absint($input['order']); |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + if (! empty($input['phone'])) { |
|
| 70 | + $args['EVT_phone'] = sanitize_text_field($input['phone']); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + if (! empty($input['shortDescription'])) { |
|
| 74 | + $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db'); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + if (! empty($input['timezoneString'])) { |
|
| 78 | + $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + if (! empty($input['visibleOn'])) { |
|
| 82 | + $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + if (! empty($input['wpUser'])) { |
|
| 86 | + $args['EVT_wp_user'] = absint($input['wpUser']); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + return apply_filters( |
|
| 90 | + 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args', |
|
| 91 | + $args, |
|
| 92 | + $input |
|
| 93 | + ); |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -21,209 +21,209 @@ |
||
| 21 | 21 | class Event extends TypeBase |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Event constructor. |
|
| 26 | - * |
|
| 27 | - * @param EEM_Event $event_model |
|
| 28 | - */ |
|
| 29 | - public function __construct(EEM_Event $event_model) |
|
| 30 | - { |
|
| 31 | - $this->model = $event_model; |
|
| 32 | - $this->setName($this->namespace . 'Event'); |
|
| 33 | - $this->setIsCustomPostType(true); |
|
| 34 | - parent::__construct(); |
|
| 35 | - } |
|
| 24 | + /** |
|
| 25 | + * Event constructor. |
|
| 26 | + * |
|
| 27 | + * @param EEM_Event $event_model |
|
| 28 | + */ |
|
| 29 | + public function __construct(EEM_Event $event_model) |
|
| 30 | + { |
|
| 31 | + $this->model = $event_model; |
|
| 32 | + $this->setName($this->namespace . 'Event'); |
|
| 33 | + $this->setIsCustomPostType(true); |
|
| 34 | + parent::__construct(); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return GraphQLFieldInterface[] |
|
| 40 | - * @since $VID:$ |
|
| 41 | - */ |
|
| 42 | - public function getFields() |
|
| 43 | - { |
|
| 44 | - $fields = [ |
|
| 45 | - new GraphQLOutputField( |
|
| 46 | - 'dbId', |
|
| 47 | - ['non_null' => 'Int'], |
|
| 48 | - 'ID', |
|
| 49 | - esc_html__('The event ID.', 'event_espresso') |
|
| 50 | - ), |
|
| 51 | - new GraphQLOutputField( |
|
| 52 | - 'cacheId', |
|
| 53 | - ['non_null' => 'String'], |
|
| 54 | - null, |
|
| 55 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 56 | - ), |
|
| 57 | - new GraphQLField( |
|
| 58 | - 'name', |
|
| 59 | - 'String', |
|
| 60 | - 'name', |
|
| 61 | - esc_html__('Event Name', 'event_espresso') |
|
| 62 | - ), |
|
| 63 | - new GraphQLField( |
|
| 64 | - 'description', |
|
| 65 | - 'String', |
|
| 66 | - 'description', |
|
| 67 | - esc_html__('Event Description', 'event_espresso') |
|
| 68 | - ), |
|
| 69 | - new GraphQLField( |
|
| 70 | - 'shortDescription', |
|
| 71 | - 'String', |
|
| 72 | - 'short_description', |
|
| 73 | - esc_html__('Event Short Description', 'event_espresso') |
|
| 74 | - ), |
|
| 75 | - new GraphQLField( |
|
| 76 | - 'created', |
|
| 77 | - 'String', |
|
| 78 | - 'created', |
|
| 79 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
| 80 | - ), |
|
| 81 | - new GraphQLOutputField( |
|
| 82 | - 'wpUser', |
|
| 83 | - 'User', |
|
| 84 | - null, |
|
| 85 | - esc_html__('Event Creator', 'event_espresso') |
|
| 86 | - ), |
|
| 87 | - new GraphQLInputField( |
|
| 88 | - 'wpUser', |
|
| 89 | - 'Int', |
|
| 90 | - null, |
|
| 91 | - esc_html__('Event Creator ID', 'event_espresso') |
|
| 92 | - ), |
|
| 93 | - new GraphQLField( |
|
| 94 | - 'order', |
|
| 95 | - 'Int', |
|
| 96 | - 'order', |
|
| 97 | - esc_html__('Event Menu Order', 'event_espresso') |
|
| 98 | - ), |
|
| 99 | - new GraphQLField( |
|
| 100 | - 'displayDescription', |
|
| 101 | - 'Boolean', |
|
| 102 | - 'display_description', |
|
| 103 | - esc_html__('Display Description Flag', 'event_espresso') |
|
| 104 | - ), |
|
| 105 | - new GraphQLField( |
|
| 106 | - 'displayTicketSelector', |
|
| 107 | - 'Boolean', |
|
| 108 | - 'display_ticket_selector', |
|
| 109 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
| 110 | - ), |
|
| 111 | - new GraphQLField( |
|
| 112 | - 'visibleOn', |
|
| 113 | - 'String', |
|
| 114 | - 'visible_on', |
|
| 115 | - esc_html__('Event Visible Date', 'event_espresso') |
|
| 116 | - ), |
|
| 117 | - new GraphQLField( |
|
| 118 | - 'additionalLimit', |
|
| 119 | - 'Int', |
|
| 120 | - 'additional_limit', |
|
| 121 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
| 122 | - ), |
|
| 123 | - new GraphQLField( |
|
| 124 | - 'phone', |
|
| 125 | - 'String', |
|
| 126 | - 'phone', |
|
| 127 | - esc_html__('Event Phone Number', 'event_espresso') |
|
| 128 | - ), |
|
| 129 | - new GraphQLField( |
|
| 130 | - 'memberOnly', |
|
| 131 | - 'Boolean', |
|
| 132 | - 'member_only', |
|
| 133 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
| 134 | - ), |
|
| 135 | - new GraphQLField( |
|
| 136 | - 'allowOverflow', |
|
| 137 | - 'Boolean', |
|
| 138 | - 'allow_overflow', |
|
| 139 | - esc_html__('Allow Overflow on Event', 'event_espresso') |
|
| 140 | - ), |
|
| 141 | - new GraphQLField( |
|
| 142 | - 'timezoneString', |
|
| 143 | - 'String', |
|
| 144 | - 'timezone_string', |
|
| 145 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
| 146 | - ), |
|
| 147 | - new GraphQLField( |
|
| 148 | - 'externalUrl', |
|
| 149 | - 'String', |
|
| 150 | - 'external_url', |
|
| 151 | - esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
| 152 | - ), |
|
| 153 | - new GraphQLField( |
|
| 154 | - 'donations', |
|
| 155 | - 'Boolean', |
|
| 156 | - 'donations', |
|
| 157 | - esc_html__('Accept Donations?', 'event_espresso') |
|
| 158 | - ), |
|
| 159 | - new GraphQLField( |
|
| 160 | - 'isSoldOut', |
|
| 161 | - 'Boolean', |
|
| 162 | - 'is_sold_out', |
|
| 163 | - esc_html__( |
|
| 164 | - 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 165 | - 'event_espresso' |
|
| 166 | - ) |
|
| 167 | - ), |
|
| 168 | - new GraphQLField( |
|
| 169 | - 'isPostponed', |
|
| 170 | - 'Boolean', |
|
| 171 | - 'is_postponed', |
|
| 172 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
| 173 | - ), |
|
| 174 | - new GraphQLField( |
|
| 175 | - 'isCancelled', |
|
| 176 | - 'Boolean', |
|
| 177 | - 'is_cancelled', |
|
| 178 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
| 179 | - ), |
|
| 180 | - new GraphQLOutputField( |
|
| 181 | - 'isUpcoming', |
|
| 182 | - 'Boolean', |
|
| 183 | - 'is_upcoming', |
|
| 184 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
| 185 | - ), |
|
| 186 | - new GraphQLOutputField( |
|
| 187 | - 'isActive', |
|
| 188 | - 'Boolean', |
|
| 189 | - 'is_active', |
|
| 190 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
| 191 | - ), |
|
| 192 | - new GraphQLOutputField( |
|
| 193 | - 'isInactive', |
|
| 194 | - 'Boolean', |
|
| 195 | - 'is_inactive', |
|
| 196 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
| 197 | - ), |
|
| 198 | - new GraphQLOutputField( |
|
| 199 | - 'isExpired', |
|
| 200 | - 'Boolean', |
|
| 201 | - 'is_expired', |
|
| 202 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
| 203 | - ), |
|
| 204 | - ]; |
|
| 38 | + /** |
|
| 39 | + * @return GraphQLFieldInterface[] |
|
| 40 | + * @since $VID:$ |
|
| 41 | + */ |
|
| 42 | + public function getFields() |
|
| 43 | + { |
|
| 44 | + $fields = [ |
|
| 45 | + new GraphQLOutputField( |
|
| 46 | + 'dbId', |
|
| 47 | + ['non_null' => 'Int'], |
|
| 48 | + 'ID', |
|
| 49 | + esc_html__('The event ID.', 'event_espresso') |
|
| 50 | + ), |
|
| 51 | + new GraphQLOutputField( |
|
| 52 | + 'cacheId', |
|
| 53 | + ['non_null' => 'String'], |
|
| 54 | + null, |
|
| 55 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 56 | + ), |
|
| 57 | + new GraphQLField( |
|
| 58 | + 'name', |
|
| 59 | + 'String', |
|
| 60 | + 'name', |
|
| 61 | + esc_html__('Event Name', 'event_espresso') |
|
| 62 | + ), |
|
| 63 | + new GraphQLField( |
|
| 64 | + 'description', |
|
| 65 | + 'String', |
|
| 66 | + 'description', |
|
| 67 | + esc_html__('Event Description', 'event_espresso') |
|
| 68 | + ), |
|
| 69 | + new GraphQLField( |
|
| 70 | + 'shortDescription', |
|
| 71 | + 'String', |
|
| 72 | + 'short_description', |
|
| 73 | + esc_html__('Event Short Description', 'event_espresso') |
|
| 74 | + ), |
|
| 75 | + new GraphQLField( |
|
| 76 | + 'created', |
|
| 77 | + 'String', |
|
| 78 | + 'created', |
|
| 79 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
| 80 | + ), |
|
| 81 | + new GraphQLOutputField( |
|
| 82 | + 'wpUser', |
|
| 83 | + 'User', |
|
| 84 | + null, |
|
| 85 | + esc_html__('Event Creator', 'event_espresso') |
|
| 86 | + ), |
|
| 87 | + new GraphQLInputField( |
|
| 88 | + 'wpUser', |
|
| 89 | + 'Int', |
|
| 90 | + null, |
|
| 91 | + esc_html__('Event Creator ID', 'event_espresso') |
|
| 92 | + ), |
|
| 93 | + new GraphQLField( |
|
| 94 | + 'order', |
|
| 95 | + 'Int', |
|
| 96 | + 'order', |
|
| 97 | + esc_html__('Event Menu Order', 'event_espresso') |
|
| 98 | + ), |
|
| 99 | + new GraphQLField( |
|
| 100 | + 'displayDescription', |
|
| 101 | + 'Boolean', |
|
| 102 | + 'display_description', |
|
| 103 | + esc_html__('Display Description Flag', 'event_espresso') |
|
| 104 | + ), |
|
| 105 | + new GraphQLField( |
|
| 106 | + 'displayTicketSelector', |
|
| 107 | + 'Boolean', |
|
| 108 | + 'display_ticket_selector', |
|
| 109 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
| 110 | + ), |
|
| 111 | + new GraphQLField( |
|
| 112 | + 'visibleOn', |
|
| 113 | + 'String', |
|
| 114 | + 'visible_on', |
|
| 115 | + esc_html__('Event Visible Date', 'event_espresso') |
|
| 116 | + ), |
|
| 117 | + new GraphQLField( |
|
| 118 | + 'additionalLimit', |
|
| 119 | + 'Int', |
|
| 120 | + 'additional_limit', |
|
| 121 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
| 122 | + ), |
|
| 123 | + new GraphQLField( |
|
| 124 | + 'phone', |
|
| 125 | + 'String', |
|
| 126 | + 'phone', |
|
| 127 | + esc_html__('Event Phone Number', 'event_espresso') |
|
| 128 | + ), |
|
| 129 | + new GraphQLField( |
|
| 130 | + 'memberOnly', |
|
| 131 | + 'Boolean', |
|
| 132 | + 'member_only', |
|
| 133 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
| 134 | + ), |
|
| 135 | + new GraphQLField( |
|
| 136 | + 'allowOverflow', |
|
| 137 | + 'Boolean', |
|
| 138 | + 'allow_overflow', |
|
| 139 | + esc_html__('Allow Overflow on Event', 'event_espresso') |
|
| 140 | + ), |
|
| 141 | + new GraphQLField( |
|
| 142 | + 'timezoneString', |
|
| 143 | + 'String', |
|
| 144 | + 'timezone_string', |
|
| 145 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
| 146 | + ), |
|
| 147 | + new GraphQLField( |
|
| 148 | + 'externalUrl', |
|
| 149 | + 'String', |
|
| 150 | + 'external_url', |
|
| 151 | + esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
| 152 | + ), |
|
| 153 | + new GraphQLField( |
|
| 154 | + 'donations', |
|
| 155 | + 'Boolean', |
|
| 156 | + 'donations', |
|
| 157 | + esc_html__('Accept Donations?', 'event_espresso') |
|
| 158 | + ), |
|
| 159 | + new GraphQLField( |
|
| 160 | + 'isSoldOut', |
|
| 161 | + 'Boolean', |
|
| 162 | + 'is_sold_out', |
|
| 163 | + esc_html__( |
|
| 164 | + 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 165 | + 'event_espresso' |
|
| 166 | + ) |
|
| 167 | + ), |
|
| 168 | + new GraphQLField( |
|
| 169 | + 'isPostponed', |
|
| 170 | + 'Boolean', |
|
| 171 | + 'is_postponed', |
|
| 172 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
| 173 | + ), |
|
| 174 | + new GraphQLField( |
|
| 175 | + 'isCancelled', |
|
| 176 | + 'Boolean', |
|
| 177 | + 'is_cancelled', |
|
| 178 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
| 179 | + ), |
|
| 180 | + new GraphQLOutputField( |
|
| 181 | + 'isUpcoming', |
|
| 182 | + 'Boolean', |
|
| 183 | + 'is_upcoming', |
|
| 184 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
| 185 | + ), |
|
| 186 | + new GraphQLOutputField( |
|
| 187 | + 'isActive', |
|
| 188 | + 'Boolean', |
|
| 189 | + 'is_active', |
|
| 190 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
| 191 | + ), |
|
| 192 | + new GraphQLOutputField( |
|
| 193 | + 'isInactive', |
|
| 194 | + 'Boolean', |
|
| 195 | + 'is_inactive', |
|
| 196 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
| 197 | + ), |
|
| 198 | + new GraphQLOutputField( |
|
| 199 | + 'isExpired', |
|
| 200 | + 'Boolean', |
|
| 201 | + 'is_expired', |
|
| 202 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
| 203 | + ), |
|
| 204 | + ]; |
|
| 205 | 205 | |
| 206 | - return apply_filters( |
|
| 207 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
| 208 | - $fields, |
|
| 209 | - $this->name, |
|
| 210 | - $this->model |
|
| 211 | - ); |
|
| 212 | - } |
|
| 206 | + return apply_filters( |
|
| 207 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
| 208 | + $fields, |
|
| 209 | + $this->name, |
|
| 210 | + $this->model |
|
| 211 | + ); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Extends the existing WP GraphQL mutations. |
|
| 217 | - * |
|
| 218 | - * @since $VID:$ |
|
| 219 | - */ |
|
| 220 | - public function extendMutations() |
|
| 221 | - { |
|
| 222 | - add_action( |
|
| 223 | - 'graphql_post_object_mutation_update_additional_data', |
|
| 224 | - EventUpdate::mutateFields($this->model, $this), |
|
| 225 | - 10, |
|
| 226 | - 6 |
|
| 227 | - ); |
|
| 228 | - } |
|
| 215 | + /** |
|
| 216 | + * Extends the existing WP GraphQL mutations. |
|
| 217 | + * |
|
| 218 | + * @since $VID:$ |
|
| 219 | + */ |
|
| 220 | + public function extendMutations() |
|
| 221 | + { |
|
| 222 | + add_action( |
|
| 223 | + 'graphql_post_object_mutation_update_additional_data', |
|
| 224 | + EventUpdate::mutateFields($this->model, $this), |
|
| 225 | + 10, |
|
| 226 | + 6 |
|
| 227 | + ); |
|
| 228 | + } |
|
| 229 | 229 | } |
@@ -9,84 +9,84 @@ |
||
| 9 | 9 | class RootQueryEventsConnection extends AbstractRootQueryConnection |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * EventsConnection constructor. |
|
| 14 | - * |
|
| 15 | - * @param EEM_Event $model |
|
| 16 | - */ |
|
| 17 | - public function __construct(EEM_Event $model) |
|
| 18 | - { |
|
| 19 | - $this->model = $model; |
|
| 20 | - } |
|
| 12 | + /** |
|
| 13 | + * EventsConnection constructor. |
|
| 14 | + * |
|
| 15 | + * @param EEM_Event $model |
|
| 16 | + */ |
|
| 17 | + public function __construct(EEM_Event $model) |
|
| 18 | + { |
|
| 19 | + $this->model = $model; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @inheritDoc |
|
| 25 | - */ |
|
| 26 | - public function config() |
|
| 27 | - { |
|
| 28 | - return [ |
|
| 29 | - 'fromType' => 'RootQuery', |
|
| 30 | - 'toType' => $this->namespace . 'Event', |
|
| 31 | - 'fromFieldName' => lcfirst($this->namespace . 'Events'), |
|
| 32 | - 'connectionTypeName' => "{$this->namespace}RootQueryEventsConnection", |
|
| 33 | - 'connectionArgs' => self::get_connection_args(), |
|
| 34 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 35 | - ]; |
|
| 36 | - } |
|
| 23 | + /** |
|
| 24 | + * @inheritDoc |
|
| 25 | + */ |
|
| 26 | + public function config() |
|
| 27 | + { |
|
| 28 | + return [ |
|
| 29 | + 'fromType' => 'RootQuery', |
|
| 30 | + 'toType' => $this->namespace . 'Event', |
|
| 31 | + 'fromFieldName' => lcfirst($this->namespace . 'Events'), |
|
| 32 | + 'connectionTypeName' => "{$this->namespace}RootQueryEventsConnection", |
|
| 33 | + 'connectionArgs' => self::get_connection_args(), |
|
| 34 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 35 | + ]; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 40 | - * |
|
| 41 | - * @access public |
|
| 42 | - * @param array $args The args to modify the defaults |
|
| 43 | - * @return array |
|
| 44 | - */ |
|
| 45 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 46 | - public static function get_connection_args($args = []) |
|
| 47 | - { |
|
| 48 | - $newArgs = [ |
|
| 49 | - 'datetime' => [ |
|
| 50 | - 'type' => 'ID', |
|
| 51 | - 'description' => esc_html__( |
|
| 52 | - 'Globally unique datetime ID to get the events for.', |
|
| 53 | - 'event_espresso' |
|
| 54 | - ), |
|
| 55 | - ], |
|
| 56 | - 'datetimeIn' => [ |
|
| 57 | - 'type' => ['list_of' => 'ID'], |
|
| 58 | - 'description' => esc_html__( |
|
| 59 | - 'Globally unique datetime IDs to get the events for.', |
|
| 60 | - 'event_espresso' |
|
| 61 | - ), |
|
| 62 | - ], |
|
| 63 | - 'orderby' => [ |
|
| 64 | - 'type' => ['list_of' => 'EspressoEventsConnectionOrderbyInput'], |
|
| 65 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 66 | - ], |
|
| 67 | - 'search' => [ |
|
| 68 | - 'type' => 'String', |
|
| 69 | - 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
| 70 | - ], |
|
| 71 | - ]; |
|
| 38 | + /** |
|
| 39 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 40 | + * |
|
| 41 | + * @access public |
|
| 42 | + * @param array $args The args to modify the defaults |
|
| 43 | + * @return array |
|
| 44 | + */ |
|
| 45 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 46 | + public static function get_connection_args($args = []) |
|
| 47 | + { |
|
| 48 | + $newArgs = [ |
|
| 49 | + 'datetime' => [ |
|
| 50 | + 'type' => 'ID', |
|
| 51 | + 'description' => esc_html__( |
|
| 52 | + 'Globally unique datetime ID to get the events for.', |
|
| 53 | + 'event_espresso' |
|
| 54 | + ), |
|
| 55 | + ], |
|
| 56 | + 'datetimeIn' => [ |
|
| 57 | + 'type' => ['list_of' => 'ID'], |
|
| 58 | + 'description' => esc_html__( |
|
| 59 | + 'Globally unique datetime IDs to get the events for.', |
|
| 60 | + 'event_espresso' |
|
| 61 | + ), |
|
| 62 | + ], |
|
| 63 | + 'orderby' => [ |
|
| 64 | + 'type' => ['list_of' => 'EspressoEventsConnectionOrderbyInput'], |
|
| 65 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 66 | + ], |
|
| 67 | + 'search' => [ |
|
| 68 | + 'type' => 'String', |
|
| 69 | + 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
| 70 | + ], |
|
| 71 | + ]; |
|
| 72 | 72 | |
| 73 | - $newArgs = apply_filters( |
|
| 74 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__attendee_args', |
|
| 75 | - $newArgs, |
|
| 76 | - $args |
|
| 77 | - ); |
|
| 78 | - return array_merge( |
|
| 79 | - $newArgs, |
|
| 80 | - $args |
|
| 81 | - ); |
|
| 82 | - } |
|
| 73 | + $newArgs = apply_filters( |
|
| 74 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__attendee_args', |
|
| 75 | + $newArgs, |
|
| 76 | + $args |
|
| 77 | + ); |
|
| 78 | + return array_merge( |
|
| 79 | + $newArgs, |
|
| 80 | + $args |
|
| 81 | + ); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * @inheritDoc |
|
| 87 | - */ |
|
| 88 | - public function getConnectionResolver($entity, $args, $context, $info) |
|
| 89 | - { |
|
| 90 | - return new EventConnectionResolver($entity, $args, $context, $info); |
|
| 91 | - } |
|
| 85 | + /** |
|
| 86 | + * @inheritDoc |
|
| 87 | + */ |
|
| 88 | + public function getConnectionResolver($entity, $args, $context, $info) |
|
| 89 | + { |
|
| 90 | + return new EventConnectionResolver($entity, $args, $context, $info); |
|
| 91 | + } |
|
| 92 | 92 | } |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | { |
| 28 | 28 | return [ |
| 29 | 29 | 'fromType' => 'RootQuery', |
| 30 | - 'toType' => $this->namespace . 'Event', |
|
| 31 | - 'fromFieldName' => lcfirst($this->namespace . 'Events'), |
|
| 30 | + 'toType' => $this->namespace.'Event', |
|
| 31 | + 'fromFieldName' => lcfirst($this->namespace.'Events'), |
|
| 32 | 32 | 'connectionTypeName' => "{$this->namespace}RootQueryEventsConnection", |
| 33 | 33 | 'connectionArgs' => self::get_connection_args(), |
| 34 | 34 | 'resolve' => [$this, 'resolveConnection'], |