@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | 34 | try { |
35 | 35 | |
36 | 36 | EntityMutator::checkPermissions($model); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $id = $entity->save(); |
48 | 48 | EntityMutator::validateResults($id); |
49 | 49 | |
50 | - if (! empty($tickets)) { |
|
50 | + if ( ! empty($tickets)) { |
|
51 | 51 | DatetimeMutation::setRelatedTickets($entity, $tickets); |
52 | 52 | } |
53 | 53 |
@@ -13,57 +13,57 @@ |
||
13 | 13 | class DatetimeCreate extends EntityMutator |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Defines the mutation data modification closure. |
|
18 | - * |
|
19 | - * @param EEM_Datetime $model |
|
20 | - * @param Datetime $type |
|
21 | - * @return callable |
|
22 | - */ |
|
23 | - public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
24 | - { |
|
25 | - /** |
|
26 | - * Creates an entity. |
|
27 | - * |
|
28 | - * @param array $input The input for the mutation |
|
29 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | - try { |
|
35 | - EntityMutator::checkPermissions($model); |
|
16 | + /** |
|
17 | + * Defines the mutation data modification closure. |
|
18 | + * |
|
19 | + * @param EEM_Datetime $model |
|
20 | + * @param Datetime $type |
|
21 | + * @return callable |
|
22 | + */ |
|
23 | + public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
24 | + { |
|
25 | + /** |
|
26 | + * Creates an entity. |
|
27 | + * |
|
28 | + * @param array $input The input for the mutation |
|
29 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | + try { |
|
35 | + EntityMutator::checkPermissions($model); |
|
36 | 36 | |
37 | - $tickets = []; |
|
38 | - $args = DatetimeMutation::prepareFields($input); |
|
37 | + $tickets = []; |
|
38 | + $args = DatetimeMutation::prepareFields($input); |
|
39 | 39 | |
40 | - if (isset($args['tickets'])) { |
|
41 | - $tickets = $args['tickets']; |
|
42 | - unset($args['tickets']); |
|
43 | - } |
|
40 | + if (isset($args['tickets'])) { |
|
41 | + $tickets = $args['tickets']; |
|
42 | + unset($args['tickets']); |
|
43 | + } |
|
44 | 44 | |
45 | - $entity = EE_Datetime::new_instance($args); |
|
46 | - $id = $entity->save(); |
|
47 | - EntityMutator::validateResults($id); |
|
45 | + $entity = EE_Datetime::new_instance($args); |
|
46 | + $id = $entity->save(); |
|
47 | + EntityMutator::validateResults($id); |
|
48 | 48 | |
49 | - if (! empty($tickets)) { |
|
50 | - DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
51 | - } |
|
49 | + if (! empty($tickets)) { |
|
50 | + DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
51 | + } |
|
52 | 52 | |
53 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_create', $entity, $input); |
|
54 | - } catch (Exception $exception) { |
|
55 | - EntityMutator::handleExceptions( |
|
56 | - $exception, |
|
57 | - esc_html__( |
|
58 | - 'The datetime could not be created because of the following error(s)', |
|
59 | - 'event_espresso' |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
53 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_create', $entity, $input); |
|
54 | + } catch (Exception $exception) { |
|
55 | + EntityMutator::handleExceptions( |
|
56 | + $exception, |
|
57 | + esc_html__( |
|
58 | + 'The datetime could not be created because of the following error(s)', |
|
59 | + 'event_espresso' |
|
60 | + ) |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | |
64 | - return [ |
|
65 | - 'id' => $id, |
|
66 | - ]; |
|
67 | - }; |
|
68 | - } |
|
64 | + return [ |
|
65 | + 'id' => $id, |
|
66 | + ]; |
|
67 | + }; |
|
68 | + } |
|
69 | 69 | } |
@@ -13,66 +13,66 @@ |
||
13 | 13 | class TicketUpdate extends EntityMutator |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Defines the mutation data modification closure. |
|
18 | - * |
|
19 | - * @param EEM_Ticket $model |
|
20 | - * @param Ticket $type |
|
21 | - * @return callable |
|
22 | - */ |
|
23 | - public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
24 | - { |
|
25 | - /** |
|
26 | - * Updates an entity. |
|
27 | - * |
|
28 | - * @param array $input The input for the mutation |
|
29 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | - try { |
|
35 | - /** @var EE_Ticket $entity */ |
|
36 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
16 | + /** |
|
17 | + * Defines the mutation data modification closure. |
|
18 | + * |
|
19 | + * @param EEM_Ticket $model |
|
20 | + * @param Ticket $type |
|
21 | + * @return callable |
|
22 | + */ |
|
23 | + public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
24 | + { |
|
25 | + /** |
|
26 | + * Updates an entity. |
|
27 | + * |
|
28 | + * @param array $input The input for the mutation |
|
29 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | + try { |
|
35 | + /** @var EE_Ticket $entity */ |
|
36 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
37 | 37 | |
38 | - $datetimes = []; |
|
39 | - $prices = null; |
|
38 | + $datetimes = []; |
|
39 | + $prices = null; |
|
40 | 40 | |
41 | - $args = TicketMutation::prepareFields($input); |
|
41 | + $args = TicketMutation::prepareFields($input); |
|
42 | 42 | |
43 | - if (isset($args['datetimes'])) { |
|
44 | - $datetimes = $args['datetimes']; |
|
45 | - unset($args['datetimes']); |
|
46 | - } |
|
47 | - if (array_key_exists('prices', $args)) { |
|
48 | - $prices = $args['prices']; |
|
49 | - unset($args['prices']); |
|
50 | - } |
|
43 | + if (isset($args['datetimes'])) { |
|
44 | + $datetimes = $args['datetimes']; |
|
45 | + unset($args['datetimes']); |
|
46 | + } |
|
47 | + if (array_key_exists('prices', $args)) { |
|
48 | + $prices = $args['prices']; |
|
49 | + unset($args['prices']); |
|
50 | + } |
|
51 | 51 | |
52 | - $entity->save($args); |
|
52 | + $entity->save($args); |
|
53 | 53 | |
54 | - if (! empty($datetimes)) { |
|
55 | - TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
56 | - } |
|
57 | - // if prices array is passed. |
|
58 | - if (is_array($prices)) { |
|
59 | - TicketMutation::setRelatedPrices($entity, $prices); |
|
60 | - } |
|
54 | + if (! empty($datetimes)) { |
|
55 | + TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
56 | + } |
|
57 | + // if prices array is passed. |
|
58 | + if (is_array($prices)) { |
|
59 | + TicketMutation::setRelatedPrices($entity, $prices); |
|
60 | + } |
|
61 | 61 | |
62 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_update', $entity, $input); |
|
63 | - } catch (Exception $exception) { |
|
64 | - EntityMutator::handleExceptions( |
|
65 | - $exception, |
|
66 | - esc_html__( |
|
67 | - 'The ticket could not be deleted because of the following error(s)', |
|
68 | - 'event_espresso' |
|
69 | - ) |
|
70 | - ); |
|
71 | - } |
|
62 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_update', $entity, $input); |
|
63 | + } catch (Exception $exception) { |
|
64 | + EntityMutator::handleExceptions( |
|
65 | + $exception, |
|
66 | + esc_html__( |
|
67 | + 'The ticket could not be deleted because of the following error(s)', |
|
68 | + 'event_espresso' |
|
69 | + ) |
|
70 | + ); |
|
71 | + } |
|
72 | 72 | |
73 | - return [ |
|
74 | - 'id' => $entity->ID(), |
|
75 | - ]; |
|
76 | - }; |
|
77 | - } |
|
73 | + return [ |
|
74 | + 'id' => $entity->ID(), |
|
75 | + ]; |
|
76 | + }; |
|
77 | + } |
|
78 | 78 | } |
@@ -14,61 +14,61 @@ |
||
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 array|void |
|
36 | - */ |
|
37 | - return static function ( |
|
38 | - $id, |
|
39 | - array $input, |
|
40 | - WP_Post_Type $post_type_object, |
|
41 | - $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 (! property_exists($post_type_object, 'graphql_single_name') |
|
51 | - || $post_type_object->graphql_single_name !== $type->name()) { |
|
52 | - return; |
|
53 | - } |
|
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 array|void |
|
36 | + */ |
|
37 | + return static function ( |
|
38 | + $id, |
|
39 | + array $input, |
|
40 | + WP_Post_Type $post_type_object, |
|
41 | + $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 (! property_exists($post_type_object, 'graphql_single_name') |
|
51 | + || $post_type_object->graphql_single_name !== $type->name()) { |
|
52 | + return; |
|
53 | + } |
|
54 | 54 | |
55 | - /** @var EE_Event $entity */ |
|
56 | - $entity = EntityMutator::getEntityFromID($model, $id); |
|
57 | - $args = EventMutation::prepareFields($input, $mutation_name); |
|
55 | + /** @var EE_Event $entity */ |
|
56 | + $entity = EntityMutator::getEntityFromID($model, $id); |
|
57 | + $args = EventMutation::prepareFields($input, $mutation_name); |
|
58 | 58 | |
59 | - // Update the entity |
|
60 | - $entity->save($args); |
|
59 | + // Update the entity |
|
60 | + $entity->save($args); |
|
61 | 61 | |
62 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_event_update', $entity, $input); |
|
63 | - } catch (Exception $exception) { |
|
64 | - EntityMutator::handleExceptions( |
|
65 | - $exception, |
|
66 | - esc_html__( |
|
67 | - 'The datetime could not be updated because of the following error(s)', |
|
68 | - 'event_espresso' |
|
69 | - ) |
|
70 | - ); |
|
71 | - } |
|
72 | - }; |
|
73 | - } |
|
62 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_event_update', $entity, $input); |
|
63 | + } catch (Exception $exception) { |
|
64 | + EntityMutator::handleExceptions( |
|
65 | + $exception, |
|
66 | + esc_html__( |
|
67 | + 'The datetime could not be updated because of the following error(s)', |
|
68 | + 'event_espresso' |
|
69 | + ) |
|
70 | + ); |
|
71 | + } |
|
72 | + }; |
|
73 | + } |
|
74 | 74 | } |
@@ -13,57 +13,57 @@ |
||
13 | 13 | class DatetimeUpdate extends EntityMutator |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Defines the mutation data modification closure. |
|
18 | - * |
|
19 | - * @param EEM_Datetime $model |
|
20 | - * @param Datetime $type |
|
21 | - * @return callable |
|
22 | - */ |
|
23 | - public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
24 | - { |
|
25 | - /** |
|
26 | - * Updates an entity. |
|
27 | - * |
|
28 | - * @param array $input The input for the mutation |
|
29 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | - try { |
|
35 | - /** @var EE_Datetime $entity */ |
|
36 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
16 | + /** |
|
17 | + * Defines the mutation data modification closure. |
|
18 | + * |
|
19 | + * @param EEM_Datetime $model |
|
20 | + * @param Datetime $type |
|
21 | + * @return callable |
|
22 | + */ |
|
23 | + public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
24 | + { |
|
25 | + /** |
|
26 | + * Updates an entity. |
|
27 | + * |
|
28 | + * @param array $input The input for the mutation |
|
29 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | + try { |
|
35 | + /** @var EE_Datetime $entity */ |
|
36 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
37 | 37 | |
38 | - $tickets = []; |
|
39 | - $args = DatetimeMutation::prepareFields($input); |
|
38 | + $tickets = []; |
|
39 | + $args = DatetimeMutation::prepareFields($input); |
|
40 | 40 | |
41 | - if (isset($args['tickets'])) { |
|
42 | - $tickets = $args['tickets']; |
|
43 | - unset($args['tickets']); |
|
44 | - } |
|
41 | + if (isset($args['tickets'])) { |
|
42 | + $tickets = $args['tickets']; |
|
43 | + unset($args['tickets']); |
|
44 | + } |
|
45 | 45 | |
46 | - // Update the entity |
|
47 | - $entity->save($args); |
|
46 | + // Update the entity |
|
47 | + $entity->save($args); |
|
48 | 48 | |
49 | - if (! empty($tickets)) { |
|
50 | - DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
51 | - } |
|
49 | + if (! empty($tickets)) { |
|
50 | + DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
51 | + } |
|
52 | 52 | |
53 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_update', $entity, $input); |
|
54 | - } catch (Exception $exception) { |
|
55 | - EntityMutator::handleExceptions( |
|
56 | - $exception, |
|
57 | - esc_html__( |
|
58 | - 'The datetime could not be updated because of the following error(s)', |
|
59 | - 'event_espresso' |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
53 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_update', $entity, $input); |
|
54 | + } catch (Exception $exception) { |
|
55 | + EntityMutator::handleExceptions( |
|
56 | + $exception, |
|
57 | + esc_html__( |
|
58 | + 'The datetime could not be updated because of the following error(s)', |
|
59 | + 'event_espresso' |
|
60 | + ) |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | |
64 | - return [ |
|
65 | - 'id' => $entity->ID(), |
|
66 | - ]; |
|
67 | - }; |
|
68 | - } |
|
64 | + return [ |
|
65 | + 'id' => $entity->ID(), |
|
66 | + ]; |
|
67 | + }; |
|
68 | + } |
|
69 | 69 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | 34 | try { |
35 | 35 | /** @var EE_Datetime $entity */ |
36 | 36 | $entity = EntityMutator::getEntityFromInputData($model, $input); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Update the entity |
47 | 47 | $entity->save($args); |
48 | 48 | |
49 | - if (! empty($tickets)) { |
|
49 | + if ( ! empty($tickets)) { |
|
50 | 50 | DatetimeMutation::setRelatedTickets($entity, $tickets); |
51 | 51 | } |
52 | 52 |
@@ -13,70 +13,70 @@ |
||
13 | 13 | class TicketCreate extends EntityMutator |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Defines the mutation data modification closure. |
|
18 | - * |
|
19 | - * @param EEM_Ticket $model |
|
20 | - * @param Ticket $type |
|
21 | - * @return callable |
|
22 | - */ |
|
23 | - public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
24 | - { |
|
25 | - /** |
|
26 | - * Creates an entity. |
|
27 | - * |
|
28 | - * @param array $input The input for the mutation |
|
29 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | - try { |
|
35 | - EntityMutator::checkPermissions($model); |
|
16 | + /** |
|
17 | + * Defines the mutation data modification closure. |
|
18 | + * |
|
19 | + * @param EEM_Ticket $model |
|
20 | + * @param Ticket $type |
|
21 | + * @return callable |
|
22 | + */ |
|
23 | + public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
24 | + { |
|
25 | + /** |
|
26 | + * Creates an entity. |
|
27 | + * |
|
28 | + * @param array $input The input for the mutation |
|
29 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | + try { |
|
35 | + EntityMutator::checkPermissions($model); |
|
36 | 36 | |
37 | - $datetimes = []; |
|
38 | - $prices = []; |
|
37 | + $datetimes = []; |
|
38 | + $prices = []; |
|
39 | 39 | |
40 | - $args = TicketMutation::prepareFields($input); |
|
40 | + $args = TicketMutation::prepareFields($input); |
|
41 | 41 | |
42 | - if (isset($args['datetimes'])) { |
|
43 | - $datetimes = $args['datetimes']; |
|
44 | - unset($args['datetimes']); |
|
45 | - } |
|
46 | - if (isset($args['prices'])) { |
|
47 | - $prices = $args['prices']; |
|
48 | - unset($args['prices']); |
|
49 | - } |
|
42 | + if (isset($args['datetimes'])) { |
|
43 | + $datetimes = $args['datetimes']; |
|
44 | + unset($args['datetimes']); |
|
45 | + } |
|
46 | + if (isset($args['prices'])) { |
|
47 | + $prices = $args['prices']; |
|
48 | + unset($args['prices']); |
|
49 | + } |
|
50 | 50 | |
51 | - $entity = EE_Ticket::new_instance($args); |
|
52 | - $id = $entity->save(); |
|
53 | - EntityMutator::validateResults($id); |
|
51 | + $entity = EE_Ticket::new_instance($args); |
|
52 | + $id = $entity->save(); |
|
53 | + EntityMutator::validateResults($id); |
|
54 | 54 | |
55 | - if (! empty($datetimes)) { |
|
56 | - TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
57 | - } |
|
58 | - // if prices are passed. |
|
59 | - if (! empty($prices)) { |
|
60 | - TicketMutation::setRelatedPrices($entity, $prices); |
|
61 | - } else { |
|
62 | - // we do this client-side |
|
63 | - // TicketMutation::addDefaultPrices($entity, $model); |
|
64 | - } |
|
55 | + if (! empty($datetimes)) { |
|
56 | + TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
57 | + } |
|
58 | + // if prices are passed. |
|
59 | + if (! empty($prices)) { |
|
60 | + TicketMutation::setRelatedPrices($entity, $prices); |
|
61 | + } else { |
|
62 | + // we do this client-side |
|
63 | + // TicketMutation::addDefaultPrices($entity, $model); |
|
64 | + } |
|
65 | 65 | |
66 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_create', $entity, $input); |
|
67 | - } catch (Exception $exception) { |
|
68 | - EntityMutator::handleExceptions( |
|
69 | - $exception, |
|
70 | - esc_html__( |
|
71 | - 'The ticket could not be created because of the following error(s)', |
|
72 | - 'event_espresso' |
|
73 | - ) |
|
74 | - ); |
|
75 | - } |
|
66 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_create', $entity, $input); |
|
67 | + } catch (Exception $exception) { |
|
68 | + EntityMutator::handleExceptions( |
|
69 | + $exception, |
|
70 | + esc_html__( |
|
71 | + 'The ticket could not be created because of the following error(s)', |
|
72 | + 'event_espresso' |
|
73 | + ) |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | - return [ |
|
78 | - 'id' => $id, |
|
79 | - ]; |
|
80 | - }; |
|
81 | - } |
|
77 | + return [ |
|
78 | + 'id' => $id, |
|
79 | + ]; |
|
80 | + }; |
|
81 | + } |
|
82 | 82 | } |
@@ -17,111 +17,111 @@ |
||
17 | 17 | class DatetimeDelete extends EntityMutator |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Defines the mutation data modification closure. |
|
22 | - * |
|
23 | - * @param EEM_Datetime $model |
|
24 | - * @param Datetime $type |
|
25 | - * @return callable |
|
26 | - */ |
|
27 | - public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
28 | - { |
|
29 | - /** |
|
30 | - * Deletes an entity. |
|
31 | - * |
|
32 | - * @param array $input The input for the mutation |
|
33 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | - * @return array|void |
|
36 | - */ |
|
37 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
38 | - try { |
|
39 | - /** @var EE_Datetime $entity */ |
|
40 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
20 | + /** |
|
21 | + * Defines the mutation data modification closure. |
|
22 | + * |
|
23 | + * @param EEM_Datetime $model |
|
24 | + * @param Datetime $type |
|
25 | + * @return callable |
|
26 | + */ |
|
27 | + public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
28 | + { |
|
29 | + /** |
|
30 | + * Deletes an entity. |
|
31 | + * |
|
32 | + * @param array $input The input for the mutation |
|
33 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | + * @return array|void |
|
36 | + */ |
|
37 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
38 | + try { |
|
39 | + /** @var EE_Datetime $entity */ |
|
40 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
41 | 41 | |
42 | - // Delete the entity |
|
43 | - if (! empty($input['deletePermanently'])) { |
|
44 | - $result = DatetimeDelete::deleteDatetimeAndRelations($entity); |
|
45 | - } else { |
|
46 | - $result = DatetimeDelete::trashDatetimeAndRelations($entity); |
|
47 | - } |
|
48 | - EntityMutator::validateResults($result); |
|
42 | + // Delete the entity |
|
43 | + if (! empty($input['deletePermanently'])) { |
|
44 | + $result = DatetimeDelete::deleteDatetimeAndRelations($entity); |
|
45 | + } else { |
|
46 | + $result = DatetimeDelete::trashDatetimeAndRelations($entity); |
|
47 | + } |
|
48 | + EntityMutator::validateResults($result); |
|
49 | 49 | |
50 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_delete', $entity, $input); |
|
51 | - } catch (Exception $exception) { |
|
52 | - EntityMutator::handleExceptions( |
|
53 | - $exception, |
|
54 | - esc_html__( |
|
55 | - 'The datetime could not be deleted because of the following error(s)', |
|
56 | - 'event_espresso' |
|
57 | - ) |
|
58 | - ); |
|
59 | - } |
|
50 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_delete', $entity, $input); |
|
51 | + } catch (Exception $exception) { |
|
52 | + EntityMutator::handleExceptions( |
|
53 | + $exception, |
|
54 | + esc_html__( |
|
55 | + 'The datetime could not be deleted because of the following error(s)', |
|
56 | + 'event_espresso' |
|
57 | + ) |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | |
61 | - return [ |
|
62 | - 'deleted' => $entity, |
|
63 | - ]; |
|
64 | - }; |
|
65 | - } |
|
61 | + return [ |
|
62 | + 'deleted' => $entity, |
|
63 | + ]; |
|
64 | + }; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Deletes a datetime permanently along with its relations. |
|
69 | - * |
|
70 | - * @param EE_Datetime $entity |
|
71 | - * @return bool | int |
|
72 | - * @throws ReflectionException |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws InvalidInterfaceException |
|
75 | - * @throws InvalidDataTypeException |
|
76 | - * @throws EE_Error |
|
77 | - */ |
|
78 | - public static function deleteDatetimeAndRelations($entity) |
|
79 | - { |
|
80 | - // all related tickets |
|
81 | - $tickets = $entity->tickets(); |
|
82 | - foreach ($tickets as $ticket) { |
|
83 | - // if the ticket is related to only one datetime |
|
84 | - if ($ticket->count_related('Datetime') === 1) { |
|
85 | - TicketDelete::deleteTicketAndRelations($ticket); |
|
86 | - } |
|
87 | - } |
|
67 | + /** |
|
68 | + * Deletes a datetime permanently along with its relations. |
|
69 | + * |
|
70 | + * @param EE_Datetime $entity |
|
71 | + * @return bool | int |
|
72 | + * @throws ReflectionException |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws InvalidInterfaceException |
|
75 | + * @throws InvalidDataTypeException |
|
76 | + * @throws EE_Error |
|
77 | + */ |
|
78 | + public static function deleteDatetimeAndRelations($entity) |
|
79 | + { |
|
80 | + // all related tickets |
|
81 | + $tickets = $entity->tickets(); |
|
82 | + foreach ($tickets as $ticket) { |
|
83 | + // if the ticket is related to only one datetime |
|
84 | + if ($ticket->count_related('Datetime') === 1) { |
|
85 | + TicketDelete::deleteTicketAndRelations($ticket); |
|
86 | + } |
|
87 | + } |
|
88 | 88 | |
89 | - // Remove relations with tickets |
|
90 | - $entity->_remove_relations('Ticket'); |
|
91 | - // Now delete the datetime permanently |
|
92 | - $result = $entity->delete_permanently(); |
|
89 | + // Remove relations with tickets |
|
90 | + $entity->_remove_relations('Ticket'); |
|
91 | + // Now delete the datetime permanently |
|
92 | + $result = $entity->delete_permanently(); |
|
93 | 93 | |
94 | - return $result; |
|
95 | - } |
|
94 | + return $result; |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Trashes a datetime along with its lone relations. |
|
99 | - * |
|
100 | - * @param EE_Datetime $entity |
|
101 | - * @return bool | int |
|
102 | - * @throws ReflectionException |
|
103 | - * @throws InvalidArgumentException |
|
104 | - * @throws InvalidInterfaceException |
|
105 | - * @throws InvalidDataTypeException |
|
106 | - * @throws EE_Error |
|
107 | - */ |
|
108 | - public static function trashDatetimeAndRelations($entity) |
|
109 | - { |
|
110 | - // non trashed related tickets |
|
111 | - $tickets = $entity->tickets([[ |
|
112 | - 'TKT_deleted' => false, |
|
113 | - ]]); |
|
114 | - // loop though all tickets to check if we need to trash any |
|
115 | - foreach ($tickets as $ticket) { |
|
116 | - // if the ticket is related to only one datetime |
|
117 | - if ($ticket->count_related('Datetime') === 1) { |
|
118 | - // trash the ticket |
|
119 | - $ticket->delete(); |
|
120 | - } |
|
121 | - } |
|
122 | - // trash the datetime |
|
123 | - $result = $entity->delete(); |
|
97 | + /** |
|
98 | + * Trashes a datetime along with its lone relations. |
|
99 | + * |
|
100 | + * @param EE_Datetime $entity |
|
101 | + * @return bool | int |
|
102 | + * @throws ReflectionException |
|
103 | + * @throws InvalidArgumentException |
|
104 | + * @throws InvalidInterfaceException |
|
105 | + * @throws InvalidDataTypeException |
|
106 | + * @throws EE_Error |
|
107 | + */ |
|
108 | + public static function trashDatetimeAndRelations($entity) |
|
109 | + { |
|
110 | + // non trashed related tickets |
|
111 | + $tickets = $entity->tickets([[ |
|
112 | + 'TKT_deleted' => false, |
|
113 | + ]]); |
|
114 | + // loop though all tickets to check if we need to trash any |
|
115 | + foreach ($tickets as $ticket) { |
|
116 | + // if the ticket is related to only one datetime |
|
117 | + if ($ticket->count_related('Datetime') === 1) { |
|
118 | + // trash the ticket |
|
119 | + $ticket->delete(); |
|
120 | + } |
|
121 | + } |
|
122 | + // trash the datetime |
|
123 | + $result = $entity->delete(); |
|
124 | 124 | |
125 | - return $result; |
|
126 | - } |
|
125 | + return $result; |
|
126 | + } |
|
127 | 127 | } |
@@ -17,72 +17,72 @@ |
||
17 | 17 | class PriceDelete extends EntityMutator |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Defines the mutation data modification closure. |
|
22 | - * |
|
23 | - * @param EEM_Price $model |
|
24 | - * @param Price $type |
|
25 | - * @return callable |
|
26 | - */ |
|
27 | - public static function mutateAndGetPayload(EEM_Price $model, Price $type) |
|
28 | - { |
|
29 | - /** |
|
30 | - * Deletes an entity. |
|
31 | - * |
|
32 | - * @param array $input The input for the mutation |
|
33 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
38 | - try { |
|
39 | - /** @var EE_Price $entity */ |
|
40 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
20 | + /** |
|
21 | + * Defines the mutation data modification closure. |
|
22 | + * |
|
23 | + * @param EEM_Price $model |
|
24 | + * @param Price $type |
|
25 | + * @return callable |
|
26 | + */ |
|
27 | + public static function mutateAndGetPayload(EEM_Price $model, Price $type) |
|
28 | + { |
|
29 | + /** |
|
30 | + * Deletes an entity. |
|
31 | + * |
|
32 | + * @param array $input The input for the mutation |
|
33 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
34 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
38 | + try { |
|
39 | + /** @var EE_Price $entity */ |
|
40 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
41 | 41 | |
42 | - // Delete the entity |
|
43 | - if (! empty($input['deletePermanently'])) { |
|
44 | - $result = PriceDelete::deletePriceAndRelations($entity); |
|
45 | - } else { |
|
46 | - // trash the price |
|
47 | - $result = $entity->delete(); |
|
48 | - } |
|
49 | - EntityMutator::validateResults($result); |
|
42 | + // Delete the entity |
|
43 | + if (! empty($input['deletePermanently'])) { |
|
44 | + $result = PriceDelete::deletePriceAndRelations($entity); |
|
45 | + } else { |
|
46 | + // trash the price |
|
47 | + $result = $entity->delete(); |
|
48 | + } |
|
49 | + EntityMutator::validateResults($result); |
|
50 | 50 | |
51 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_delete', $entity, $input); |
|
52 | - } catch (Exception $exception) { |
|
53 | - EntityMutator::handleExceptions( |
|
54 | - $exception, |
|
55 | - esc_html__( |
|
56 | - 'The price could not be deleted because of the following error(s)', |
|
57 | - 'event_espresso' |
|
58 | - ) |
|
59 | - ); |
|
60 | - } |
|
51 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_delete', $entity, $input); |
|
52 | + } catch (Exception $exception) { |
|
53 | + EntityMutator::handleExceptions( |
|
54 | + $exception, |
|
55 | + esc_html__( |
|
56 | + 'The price could not be deleted because of the following error(s)', |
|
57 | + 'event_espresso' |
|
58 | + ) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - return [ |
|
63 | - 'deleted' => $entity, |
|
64 | - ]; |
|
65 | - }; |
|
66 | - } |
|
62 | + return [ |
|
63 | + 'deleted' => $entity, |
|
64 | + ]; |
|
65 | + }; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Deletes a price permanently along with its relations. |
|
70 | - * |
|
71 | - * @param EE_Price $entity |
|
72 | - * @return bool | int |
|
73 | - * @throws ReflectionException |
|
74 | - * @throws InvalidArgumentException |
|
75 | - * @throws InvalidInterfaceException |
|
76 | - * @throws InvalidDataTypeException |
|
77 | - * @throws EE_Error |
|
78 | - */ |
|
79 | - public static function deletePriceAndRelations($entity) |
|
80 | - { |
|
81 | - // Remove relation with ticket |
|
82 | - $entity->_remove_relations('Ticket'); |
|
83 | - // Now delete the price permanently |
|
84 | - $result = $entity->delete_permanently(); |
|
68 | + /** |
|
69 | + * Deletes a price permanently along with its relations. |
|
70 | + * |
|
71 | + * @param EE_Price $entity |
|
72 | + * @return bool | int |
|
73 | + * @throws ReflectionException |
|
74 | + * @throws InvalidArgumentException |
|
75 | + * @throws InvalidInterfaceException |
|
76 | + * @throws InvalidDataTypeException |
|
77 | + * @throws EE_Error |
|
78 | + */ |
|
79 | + public static function deletePriceAndRelations($entity) |
|
80 | + { |
|
81 | + // Remove relation with ticket |
|
82 | + $entity->_remove_relations('Ticket'); |
|
83 | + // Now delete the price permanently |
|
84 | + $result = $entity->delete_permanently(); |
|
85 | 85 | |
86 | - return $result; |
|
87 | - } |
|
86 | + return $result; |
|
87 | + } |
|
88 | 88 | } |
@@ -14,62 +14,62 @@ |
||
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 array|void |
|
36 | - */ |
|
37 | - return static function ( |
|
38 | - $id, |
|
39 | - array $input, |
|
40 | - WP_Post_Type $post_type_object, |
|
41 | - $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 (! property_exists($post_type_object, 'graphql_single_name') |
|
51 | - || $post_type_object->graphql_single_name !== $type->name() |
|
52 | - ) { |
|
53 | - return; |
|
54 | - } |
|
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 array|void |
|
36 | + */ |
|
37 | + return static function ( |
|
38 | + $id, |
|
39 | + array $input, |
|
40 | + WP_Post_Type $post_type_object, |
|
41 | + $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 (! property_exists($post_type_object, 'graphql_single_name') |
|
51 | + || $post_type_object->graphql_single_name !== $type->name() |
|
52 | + ) { |
|
53 | + return; |
|
54 | + } |
|
55 | 55 | |
56 | - /** @var EE_Venue $entity */ |
|
57 | - $entity = EntityMutator::getEntityFromID($model, $id); |
|
58 | - $args = VenueMutation::prepareFields($input, $mutation_name); |
|
56 | + /** @var EE_Venue $entity */ |
|
57 | + $entity = EntityMutator::getEntityFromID($model, $id); |
|
58 | + $args = VenueMutation::prepareFields($input, $mutation_name); |
|
59 | 59 | |
60 | - // Update the entity |
|
61 | - $entity->save($args); |
|
60 | + // Update the entity |
|
61 | + $entity->save($args); |
|
62 | 62 | |
63 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_venue_update', $entity, $input); |
|
64 | - } catch (Exception $exception) { |
|
65 | - EntityMutator::handleExceptions( |
|
66 | - $exception, |
|
67 | - esc_html__( |
|
68 | - 'The datetime could not be updated because of the following error(s)', |
|
69 | - 'event_espresso' |
|
70 | - ) |
|
71 | - ); |
|
72 | - } |
|
73 | - }; |
|
74 | - } |
|
63 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_venue_update', $entity, $input); |
|
64 | + } catch (Exception $exception) { |
|
65 | + EntityMutator::handleExceptions( |
|
66 | + $exception, |
|
67 | + esc_html__( |
|
68 | + 'The datetime could not be updated because of the following error(s)', |
|
69 | + 'event_espresso' |
|
70 | + ) |
|
71 | + ); |
|
72 | + } |
|
73 | + }; |
|
74 | + } |
|
75 | 75 | } |
@@ -13,47 +13,47 @@ |
||
13 | 13 | class PriceUpdate extends EntityMutator |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Defines the mutation data modification closure. |
|
18 | - * |
|
19 | - * @param EEM_Price $model |
|
20 | - * @param Price $type |
|
21 | - * @return callable |
|
22 | - */ |
|
23 | - public static function mutateAndGetPayload(EEM_Price $model, Price $type) |
|
24 | - { |
|
25 | - /** |
|
26 | - * Updates an entity. |
|
27 | - * |
|
28 | - * @param array $input The input for the mutation |
|
29 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | - try { |
|
35 | - /** @var EE_Price $entity */ |
|
36 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
37 | - |
|
38 | - $args = PriceMutation::prepareFields($input); |
|
39 | - |
|
40 | - // Update the entity |
|
41 | - $entity->save($args); |
|
42 | - |
|
43 | - do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_update', $entity, $input); |
|
44 | - } catch (Exception $exception) { |
|
45 | - EntityMutator::handleExceptions( |
|
46 | - $exception, |
|
47 | - esc_html__( |
|
48 | - 'The price could not be updated because of the following error(s)', |
|
49 | - 'event_espresso' |
|
50 | - ) |
|
51 | - ); |
|
52 | - } |
|
53 | - |
|
54 | - return [ |
|
55 | - 'id' => $entity->ID(), |
|
56 | - ]; |
|
57 | - }; |
|
58 | - } |
|
16 | + /** |
|
17 | + * Defines the mutation data modification closure. |
|
18 | + * |
|
19 | + * @param EEM_Price $model |
|
20 | + * @param Price $type |
|
21 | + * @return callable |
|
22 | + */ |
|
23 | + public static function mutateAndGetPayload(EEM_Price $model, Price $type) |
|
24 | + { |
|
25 | + /** |
|
26 | + * Updates an entity. |
|
27 | + * |
|
28 | + * @param array $input The input for the mutation |
|
29 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
30 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | + try { |
|
35 | + /** @var EE_Price $entity */ |
|
36 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
37 | + |
|
38 | + $args = PriceMutation::prepareFields($input); |
|
39 | + |
|
40 | + // Update the entity |
|
41 | + $entity->save($args); |
|
42 | + |
|
43 | + do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_update', $entity, $input); |
|
44 | + } catch (Exception $exception) { |
|
45 | + EntityMutator::handleExceptions( |
|
46 | + $exception, |
|
47 | + esc_html__( |
|
48 | + 'The price could not be updated because of the following error(s)', |
|
49 | + 'event_espresso' |
|
50 | + ) |
|
51 | + ); |
|
52 | + } |
|
53 | + |
|
54 | + return [ |
|
55 | + 'id' => $entity->ID(), |
|
56 | + ]; |
|
57 | + }; |
|
58 | + } |
|
59 | 59 | } |