@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param EEM_Datetime $model |
27 | 27 | * @param Datetime $type |
28 | - * @return callable |
|
28 | + * @return \Closure |
|
29 | 29 | */ |
30 | 30 | public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
31 | 31 | { |
@@ -13,55 +13,55 @@ |
||
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 | - } |
|
52 | - } catch (Exception $exception) { |
|
53 | - EntityMutator::handleExceptions( |
|
54 | - $exception, |
|
55 | - esc_html__( |
|
56 | - 'The datetime could not be created because of the following error(s)', |
|
57 | - 'event_espresso' |
|
58 | - ) |
|
59 | - ); |
|
60 | - } |
|
49 | + if (! empty($tickets)) { |
|
50 | + DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
51 | + } |
|
52 | + } catch (Exception $exception) { |
|
53 | + EntityMutator::handleExceptions( |
|
54 | + $exception, |
|
55 | + esc_html__( |
|
56 | + 'The datetime could not be created because of the following error(s)', |
|
57 | + 'event_espresso' |
|
58 | + ) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - return [ |
|
63 | - 'id' => $id, |
|
64 | - ]; |
|
65 | - }; |
|
66 | - } |
|
62 | + return [ |
|
63 | + 'id' => $id, |
|
64 | + ]; |
|
65 | + }; |
|
66 | + } |
|
67 | 67 | } |
@@ -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 | EntityMutator::checkPermissions($model); |
36 | 36 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $id = $entity->save(); |
47 | 47 | EntityMutator::validateResults($id); |
48 | 48 | |
49 | - if (! empty($tickets)) { |
|
49 | + if ( ! empty($tickets)) { |
|
50 | 50 | DatetimeMutation::setRelatedTickets($entity, $tickets); |
51 | 51 | } |
52 | 52 | } catch (Exception $exception) { |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * |
19 | 19 | * @param EEM_Event $model |
20 | 20 | * @param Event $type |
21 | - * @return callable |
|
21 | + * @return \Closure |
|
22 | 22 | */ |
23 | 23 | public static function mutateFields(EEM_Event $model, Event $type) |
24 | 24 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
35 | 35 | * @return array|void |
36 | 36 | */ |
37 | - return static function ( |
|
37 | + return static function( |
|
38 | 38 | $id, |
39 | 39 | array $input, |
40 | 40 | WP_Post_Type $post_type_object, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ) { |
48 | 48 | try { |
49 | 49 | // Make sure we are dealing with the right entity. |
50 | - if (! property_exists($post_type_object, 'graphql_single_name') |
|
50 | + if ( ! property_exists($post_type_object, 'graphql_single_name') |
|
51 | 51 | || $post_type_object->graphql_single_name !== $type->name()) { |
52 | 52 | return; |
53 | 53 | } |
@@ -14,59 +14,59 @@ |
||
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); |
|
61 | - } catch (Exception $exception) { |
|
62 | - EntityMutator::handleExceptions( |
|
63 | - $exception, |
|
64 | - esc_html__( |
|
65 | - 'The datetime could not be updated because of the following error(s)', |
|
66 | - 'event_espresso' |
|
67 | - ) |
|
68 | - ); |
|
69 | - } |
|
70 | - }; |
|
71 | - } |
|
59 | + // Update the entity |
|
60 | + $entity->save($args); |
|
61 | + } catch (Exception $exception) { |
|
62 | + EntityMutator::handleExceptions( |
|
63 | + $exception, |
|
64 | + esc_html__( |
|
65 | + 'The datetime could not be updated because of the following error(s)', |
|
66 | + 'event_espresso' |
|
67 | + ) |
|
68 | + ); |
|
69 | + } |
|
70 | + }; |
|
71 | + } |
|
72 | 72 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param EEM_Ticket $model |
27 | 27 | * @param Ticket $type |
28 | - * @return callable |
|
28 | + * @return \Closure |
|
29 | 29 | */ |
30 | 30 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
31 | 31 | { |
@@ -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); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | $id = $entity->save(); |
54 | 54 | EntityMutator::validateResults($id); |
55 | 55 | |
56 | - if (! empty($datetimes)) { |
|
56 | + if ( ! empty($datetimes)) { |
|
57 | 57 | TicketMutation::setRelatedDatetimes($entity, $datetimes); |
58 | 58 | } |
59 | 59 | // if prices are passed. |
60 | - if (! empty($prices)) { |
|
60 | + if ( ! empty($prices)) { |
|
61 | 61 | TicketMutation::setRelatedPrices($entity, $prices); |
62 | 62 | } else { |
63 | 63 | TicketMutation::addDefaultPrices($entity, $model); |
@@ -13,67 +13,67 @@ |
||
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 | - TicketMutation::addDefaultPrices($entity, $model); |
|
63 | - } |
|
64 | - } catch (Exception $exception) { |
|
65 | - EntityMutator::handleExceptions( |
|
66 | - $exception, |
|
67 | - esc_html__( |
|
68 | - 'The ticket could not be created because of the following error(s)', |
|
69 | - 'event_espresso' |
|
70 | - ) |
|
71 | - ); |
|
72 | - } |
|
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 | + TicketMutation::addDefaultPrices($entity, $model); |
|
63 | + } |
|
64 | + } catch (Exception $exception) { |
|
65 | + EntityMutator::handleExceptions( |
|
66 | + $exception, |
|
67 | + esc_html__( |
|
68 | + 'The ticket could not be created because of the following error(s)', |
|
69 | + 'event_espresso' |
|
70 | + ) |
|
71 | + ); |
|
72 | + } |
|
73 | 73 | |
74 | - return [ |
|
75 | - 'id' => $id, |
|
76 | - ]; |
|
77 | - }; |
|
78 | - } |
|
74 | + return [ |
|
75 | + 'id' => $id, |
|
76 | + ]; |
|
77 | + }; |
|
78 | + } |
|
79 | 79 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * |
19 | 19 | * @param EEM_Venue $model |
20 | 20 | * @param Venue $type |
21 | - * @return callable |
|
21 | + * @return \Closure |
|
22 | 22 | */ |
23 | 23 | public static function mutateFields(EEM_Venue $model, Venue $type) |
24 | 24 | { |
@@ -14,60 +14,60 @@ |
||
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); |
|
62 | - } catch (Exception $exception) { |
|
63 | - EntityMutator::handleExceptions( |
|
64 | - $exception, |
|
65 | - esc_html__( |
|
66 | - 'The datetime could not be updated because of the following error(s)', |
|
67 | - 'event_espresso' |
|
68 | - ) |
|
69 | - ); |
|
70 | - } |
|
71 | - }; |
|
72 | - } |
|
60 | + // Update the entity |
|
61 | + $entity->save($args); |
|
62 | + } catch (Exception $exception) { |
|
63 | + EntityMutator::handleExceptions( |
|
64 | + $exception, |
|
65 | + esc_html__( |
|
66 | + 'The datetime could not be updated because of the following error(s)', |
|
67 | + 'event_espresso' |
|
68 | + ) |
|
69 | + ); |
|
70 | + } |
|
71 | + }; |
|
72 | + } |
|
73 | 73 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
35 | 35 | * @return array|void |
36 | 36 | */ |
37 | - return static function ( |
|
37 | + return static function( |
|
38 | 38 | $id, |
39 | 39 | array $input, |
40 | 40 | WP_Post_Type $post_type_object, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ) { |
48 | 48 | try { |
49 | 49 | // Make sure we are dealing with the right entity. |
50 | - if (! property_exists($post_type_object, 'graphql_single_name') |
|
50 | + if ( ! property_exists($post_type_object, 'graphql_single_name') |
|
51 | 51 | || $post_type_object->graphql_single_name !== $type->name() |
52 | 52 | ) { |
53 | 53 | return; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param EEM_Datetime $model |
27 | 27 | * @param Datetime $type |
28 | - * @return callable |
|
28 | + * @return \Closure |
|
29 | 29 | */ |
30 | 30 | public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
31 | 31 | { |
@@ -12,44 +12,44 @@ |
||
12 | 12 | class DatetimeDelete extends EntityMutator |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Defines the mutation data modification closure. |
|
17 | - * |
|
18 | - * @param EEM_Datetime $model |
|
19 | - * @param Datetime $type |
|
20 | - * @return callable |
|
21 | - */ |
|
22 | - public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
23 | - { |
|
24 | - /** |
|
25 | - * Deletes an entity. |
|
26 | - * |
|
27 | - * @param array $input The input for the mutation |
|
28 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
29 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
30 | - * @return array|void |
|
31 | - */ |
|
32 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | - try { |
|
34 | - /** @var EE_Datetime $entity */ |
|
35 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
15 | + /** |
|
16 | + * Defines the mutation data modification closure. |
|
17 | + * |
|
18 | + * @param EEM_Datetime $model |
|
19 | + * @param Datetime $type |
|
20 | + * @return callable |
|
21 | + */ |
|
22 | + public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
23 | + { |
|
24 | + /** |
|
25 | + * Deletes an entity. |
|
26 | + * |
|
27 | + * @param array $input The input for the mutation |
|
28 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
29 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
30 | + * @return array|void |
|
31 | + */ |
|
32 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | + try { |
|
34 | + /** @var EE_Datetime $entity */ |
|
35 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
36 | 36 | |
37 | - // Delete the entity |
|
38 | - $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
39 | - EntityMutator::validateResults($result); |
|
40 | - } catch (Exception $exception) { |
|
41 | - EntityMutator::handleExceptions( |
|
42 | - $exception, |
|
43 | - esc_html__( |
|
44 | - 'The datetime could not be deleted because of the following error(s)', |
|
45 | - 'event_espresso' |
|
46 | - ) |
|
47 | - ); |
|
48 | - } |
|
37 | + // Delete the entity |
|
38 | + $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
39 | + EntityMutator::validateResults($result); |
|
40 | + } catch (Exception $exception) { |
|
41 | + EntityMutator::handleExceptions( |
|
42 | + $exception, |
|
43 | + esc_html__( |
|
44 | + 'The datetime could not be deleted because of the following error(s)', |
|
45 | + 'event_espresso' |
|
46 | + ) |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | - return [ |
|
51 | - 'deleted' => $entity, |
|
52 | - ]; |
|
53 | - }; |
|
54 | - } |
|
50 | + return [ |
|
51 | + 'deleted' => $entity, |
|
52 | + ]; |
|
53 | + }; |
|
54 | + } |
|
55 | 55 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
30 | 30 | * @return array|void |
31 | 31 | */ |
32 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
32 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | 33 | try { |
34 | 34 | /** @var EE_Datetime $entity */ |
35 | 35 | $entity = EntityMutator::getEntityFromInputData($model, $input); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param EEM_Datetime $model |
27 | 27 | * @param Datetime $type |
28 | - * @return callable |
|
28 | + * @return \Closure |
|
29 | 29 | */ |
30 | 30 | public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
31 | 31 | { |
@@ -13,55 +13,55 @@ |
||
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 | - } |
|
52 | - } catch (Exception $exception) { |
|
53 | - EntityMutator::handleExceptions( |
|
54 | - $exception, |
|
55 | - esc_html__( |
|
56 | - 'The datetime could not be updated because of the following error(s)', |
|
57 | - 'event_espresso' |
|
58 | - ) |
|
59 | - ); |
|
60 | - } |
|
49 | + if (! empty($tickets)) { |
|
50 | + DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
51 | + } |
|
52 | + } catch (Exception $exception) { |
|
53 | + EntityMutator::handleExceptions( |
|
54 | + $exception, |
|
55 | + esc_html__( |
|
56 | + 'The datetime could not be updated because of the following error(s)', |
|
57 | + 'event_espresso' |
|
58 | + ) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - return [ |
|
63 | - 'id' => $entity->ID(), |
|
64 | - ]; |
|
65 | - }; |
|
66 | - } |
|
62 | + return [ |
|
63 | + 'id' => $entity->ID(), |
|
64 | + ]; |
|
65 | + }; |
|
66 | + } |
|
67 | 67 | } |
@@ -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 | } catch (Exception $exception) { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param EEM_Ticket $model |
27 | 27 | * @param Ticket $type |
28 | - * @return callable |
|
28 | + * @return \Closure |
|
29 | 29 | */ |
30 | 30 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
31 | 31 | { |
@@ -12,44 +12,44 @@ |
||
12 | 12 | class TicketDelete extends EntityMutator |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Defines the mutation data modification closure. |
|
17 | - * |
|
18 | - * @param EEM_Ticket $model |
|
19 | - * @param Ticket $type |
|
20 | - * @return callable |
|
21 | - */ |
|
22 | - public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
23 | - { |
|
24 | - /** |
|
25 | - * Deletes an entity. |
|
26 | - * |
|
27 | - * @param array $input The input for the mutation |
|
28 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
29 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | - try { |
|
34 | - /** @var EE_Ticket $entity */ |
|
35 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
15 | + /** |
|
16 | + * Defines the mutation data modification closure. |
|
17 | + * |
|
18 | + * @param EEM_Ticket $model |
|
19 | + * @param Ticket $type |
|
20 | + * @return callable |
|
21 | + */ |
|
22 | + public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
23 | + { |
|
24 | + /** |
|
25 | + * Deletes an entity. |
|
26 | + * |
|
27 | + * @param array $input The input for the mutation |
|
28 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
29 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | + try { |
|
34 | + /** @var EE_Ticket $entity */ |
|
35 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
36 | 36 | |
37 | - // Delete the entity |
|
38 | - $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
39 | - EntityMutator::validateResults($result); |
|
40 | - } catch (Exception $exception) { |
|
41 | - EntityMutator::handleExceptions( |
|
42 | - $exception, |
|
43 | - esc_html__( |
|
44 | - 'The ticket could not be deleted because of the following error(s)', |
|
45 | - 'event_espresso' |
|
46 | - ) |
|
47 | - ); |
|
48 | - } |
|
37 | + // Delete the entity |
|
38 | + $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
39 | + EntityMutator::validateResults($result); |
|
40 | + } catch (Exception $exception) { |
|
41 | + EntityMutator::handleExceptions( |
|
42 | + $exception, |
|
43 | + esc_html__( |
|
44 | + 'The ticket could not be deleted because of the following error(s)', |
|
45 | + 'event_espresso' |
|
46 | + ) |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | - return [ |
|
51 | - 'deleted' => $entity, |
|
52 | - ]; |
|
53 | - }; |
|
54 | - } |
|
50 | + return [ |
|
51 | + 'deleted' => $entity, |
|
52 | + ]; |
|
53 | + }; |
|
54 | + } |
|
55 | 55 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
30 | 30 | * @return array |
31 | 31 | */ |
32 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
32 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
33 | 33 | try { |
34 | 34 | /** @var EE_Ticket $entity */ |
35 | 35 | $entity = EntityMutator::getEntityFromInputData($model, $input); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param EEM_Ticket $model |
27 | 27 | * @param Ticket $type |
28 | - * @return callable |
|
28 | + * @return \Closure |
|
29 | 29 | */ |
30 | 30 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
31 | 31 | { |
@@ -13,63 +13,63 @@ |
||
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 = []; |
|
38 | + $datetimes = []; |
|
39 | + $prices = []; |
|
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 (isset($args['prices'])) { |
|
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 (isset($args['prices'])) { |
|
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 (! empty($prices)) { |
|
58 | - TicketMutation::setRelatedPrices($entity, $prices); |
|
59 | - } |
|
60 | - } catch (Exception $exception) { |
|
61 | - EntityMutator::handleExceptions( |
|
62 | - $exception, |
|
63 | - esc_html__( |
|
64 | - 'The ticket could not be deleted because of the following error(s)', |
|
65 | - 'event_espresso' |
|
66 | - ) |
|
67 | - ); |
|
68 | - } |
|
54 | + if (! empty($datetimes)) { |
|
55 | + TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
56 | + } |
|
57 | + if (! empty($prices)) { |
|
58 | + TicketMutation::setRelatedPrices($entity, $prices); |
|
59 | + } |
|
60 | + } catch (Exception $exception) { |
|
61 | + EntityMutator::handleExceptions( |
|
62 | + $exception, |
|
63 | + esc_html__( |
|
64 | + 'The ticket could not be deleted because of the following error(s)', |
|
65 | + 'event_espresso' |
|
66 | + ) |
|
67 | + ); |
|
68 | + } |
|
69 | 69 | |
70 | - return [ |
|
71 | - 'id' => $entity->ID(), |
|
72 | - ]; |
|
73 | - }; |
|
74 | - } |
|
70 | + return [ |
|
71 | + 'id' => $entity->ID(), |
|
72 | + ]; |
|
73 | + }; |
|
74 | + } |
|
75 | 75 | } |
@@ -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_Ticket $entity */ |
36 | 36 | $entity = EntityMutator::getEntityFromInputData($model, $input); |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | |
52 | 52 | $entity->save($args); |
53 | 53 | |
54 | - if (! empty($datetimes)) { |
|
54 | + if ( ! empty($datetimes)) { |
|
55 | 55 | TicketMutation::setRelatedDatetimes($entity, $datetimes); |
56 | 56 | } |
57 | - if (! empty($prices)) { |
|
57 | + if ( ! empty($prices)) { |
|
58 | 58 | TicketMutation::setRelatedPrices($entity, $prices); |
59 | 59 | } |
60 | 60 | } catch (Exception $exception) { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param EEM_Price $model |
27 | 27 | * @param Price $type |
28 | - * @return callable |
|
28 | + * @return \Closure |
|
29 | 29 | */ |
30 | 30 | public static function mutateAndGetPayload(EEM_Price $model, Price $type) |
31 | 31 | { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
32 | 32 | * @return array |
33 | 33 | */ |
34 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
34 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
35 | 35 | try { |
36 | 36 | |
37 | 37 | EntityMutator::checkPermissions($model); |
@@ -14,52 +14,52 @@ |
||
14 | 14 | class PriceCreate extends EntityMutator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Defines the mutation data modification closure. |
|
19 | - * |
|
20 | - * @param EEM_Price $model |
|
21 | - * @param Price $type |
|
22 | - * @return callable |
|
23 | - */ |
|
24 | - public static function mutateAndGetPayload(EEM_Price $model, Price $type) |
|
25 | - { |
|
26 | - /** |
|
27 | - * Creates an entity. |
|
28 | - * |
|
29 | - * @param array $input The input for the mutation |
|
30 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
31 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
32 | - * @return array |
|
33 | - */ |
|
34 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
35 | - try { |
|
36 | - EntityMutator::checkPermissions($model); |
|
17 | + /** |
|
18 | + * Defines the mutation data modification closure. |
|
19 | + * |
|
20 | + * @param EEM_Price $model |
|
21 | + * @param Price $type |
|
22 | + * @return callable |
|
23 | + */ |
|
24 | + public static function mutateAndGetPayload(EEM_Price $model, Price $type) |
|
25 | + { |
|
26 | + /** |
|
27 | + * Creates an entity. |
|
28 | + * |
|
29 | + * @param array $input The input for the mutation |
|
30 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
31 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
32 | + * @return array |
|
33 | + */ |
|
34 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
35 | + try { |
|
36 | + EntityMutator::checkPermissions($model); |
|
37 | 37 | |
38 | - $args = PriceMutation::prepareFields($input); |
|
38 | + $args = PriceMutation::prepareFields($input); |
|
39 | 39 | |
40 | - if (empty($args['PRT_ID'])) { |
|
41 | - // translators: the placeholder is the name of the field. |
|
42 | - throw new UserError( |
|
43 | - sprintf(esc_html__('A valid %1$s must be passed.', 'event_espresso'), 'priceType') |
|
44 | - ); |
|
45 | - } |
|
40 | + if (empty($args['PRT_ID'])) { |
|
41 | + // translators: the placeholder is the name of the field. |
|
42 | + throw new UserError( |
|
43 | + sprintf(esc_html__('A valid %1$s must be passed.', 'event_espresso'), 'priceType') |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | - $entity = EE_Price::new_instance($args); |
|
48 | - $id = $entity->save(); |
|
49 | - EntityMutator::validateResults($id); |
|
50 | - } catch (Exception $exception) { |
|
51 | - EntityMutator::handleExceptions( |
|
52 | - $exception, |
|
53 | - esc_html__( |
|
54 | - 'The price could not be created because of the following error(s)', |
|
55 | - 'event_espresso' |
|
56 | - ) |
|
57 | - ); |
|
58 | - } |
|
47 | + $entity = EE_Price::new_instance($args); |
|
48 | + $id = $entity->save(); |
|
49 | + EntityMutator::validateResults($id); |
|
50 | + } catch (Exception $exception) { |
|
51 | + EntityMutator::handleExceptions( |
|
52 | + $exception, |
|
53 | + esc_html__( |
|
54 | + 'The price could not be created because of the following error(s)', |
|
55 | + 'event_espresso' |
|
56 | + ) |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | |
60 | - return [ |
|
61 | - 'id' => $id, |
|
62 | - ]; |
|
63 | - }; |
|
64 | - } |
|
60 | + return [ |
|
61 | + 'id' => $id, |
|
62 | + ]; |
|
63 | + }; |
|
64 | + } |
|
65 | 65 | } |