@@ -21,81 +21,81 @@ |
||
21 | 21 | class TicketUpdate |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Defines the mutation data modification closure. |
|
26 | - * |
|
27 | - * @param EEM_Ticket $model |
|
28 | - * @param Ticket $type |
|
29 | - * @return callable |
|
30 | - */ |
|
31 | - public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
32 | - { |
|
33 | - /** |
|
34 | - * Updates an entity. |
|
35 | - * |
|
36 | - * @param array $input The input for the mutation |
|
37 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
38 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
39 | - * @return array |
|
40 | - * @throws UserError |
|
41 | - * @throws ReflectionException |
|
42 | - * @throws InvalidArgumentException |
|
43 | - * @throws InvalidInterfaceException |
|
44 | - * @throws InvalidDataTypeException |
|
45 | - * @throws EE_Error |
|
46 | - */ |
|
47 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
48 | - /** |
|
49 | - * Stop now if a user isn't allowed to create a datetime. |
|
50 | - */ |
|
51 | - if (! current_user_can('ee_edit_events')) { |
|
52 | - // translators: the %1$s is the name of the object being mutated |
|
53 | - throw new UserError( |
|
54 | - sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name()) |
|
55 | - ); |
|
56 | - } |
|
57 | - $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
58 | - |
|
59 | - $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
60 | - $entity = null; |
|
61 | - |
|
62 | - if ($id) { |
|
63 | - $entity = $model->get_one_by_ID($id); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * If there's no existing datetime, throw an exception |
|
68 | - */ |
|
69 | - if (! $id || ! ($entity instanceof EE_Ticket)) { |
|
70 | - // translators: the placeholder is the name of the type being updated |
|
71 | - throw new UserError( |
|
72 | - sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name()) |
|
73 | - ); |
|
74 | - } |
|
75 | - |
|
76 | - $datetimes = []; |
|
77 | - |
|
78 | - $args = TicketMutation::prepareFields($input); |
|
79 | - |
|
80 | - if (isset($args['datetimes'])) { |
|
81 | - $datetimes = $args['datetimes']; |
|
82 | - unset($args['datetimes']); |
|
83 | - } |
|
84 | - |
|
85 | - // Update the entity |
|
86 | - $result = $entity->save($args); |
|
87 | - |
|
88 | - if (empty($result)) { |
|
89 | - throw new UserError(__('The object failed to update but no error was provided', 'event_espresso')); |
|
90 | - } |
|
91 | - |
|
92 | - if (! empty($datetimes)) { |
|
93 | - TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
94 | - } |
|
95 | - |
|
96 | - return [ |
|
97 | - 'id' => $id, |
|
98 | - ]; |
|
99 | - }; |
|
100 | - } |
|
24 | + /** |
|
25 | + * Defines the mutation data modification closure. |
|
26 | + * |
|
27 | + * @param EEM_Ticket $model |
|
28 | + * @param Ticket $type |
|
29 | + * @return callable |
|
30 | + */ |
|
31 | + public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
32 | + { |
|
33 | + /** |
|
34 | + * Updates an entity. |
|
35 | + * |
|
36 | + * @param array $input The input for the mutation |
|
37 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
38 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
39 | + * @return array |
|
40 | + * @throws UserError |
|
41 | + * @throws ReflectionException |
|
42 | + * @throws InvalidArgumentException |
|
43 | + * @throws InvalidInterfaceException |
|
44 | + * @throws InvalidDataTypeException |
|
45 | + * @throws EE_Error |
|
46 | + */ |
|
47 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
48 | + /** |
|
49 | + * Stop now if a user isn't allowed to create a datetime. |
|
50 | + */ |
|
51 | + if (! current_user_can('ee_edit_events')) { |
|
52 | + // translators: the %1$s is the name of the object being mutated |
|
53 | + throw new UserError( |
|
54 | + sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name()) |
|
55 | + ); |
|
56 | + } |
|
57 | + $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
58 | + |
|
59 | + $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
60 | + $entity = null; |
|
61 | + |
|
62 | + if ($id) { |
|
63 | + $entity = $model->get_one_by_ID($id); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * If there's no existing datetime, throw an exception |
|
68 | + */ |
|
69 | + if (! $id || ! ($entity instanceof EE_Ticket)) { |
|
70 | + // translators: the placeholder is the name of the type being updated |
|
71 | + throw new UserError( |
|
72 | + sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name()) |
|
73 | + ); |
|
74 | + } |
|
75 | + |
|
76 | + $datetimes = []; |
|
77 | + |
|
78 | + $args = TicketMutation::prepareFields($input); |
|
79 | + |
|
80 | + if (isset($args['datetimes'])) { |
|
81 | + $datetimes = $args['datetimes']; |
|
82 | + unset($args['datetimes']); |
|
83 | + } |
|
84 | + |
|
85 | + // Update the entity |
|
86 | + $result = $entity->save($args); |
|
87 | + |
|
88 | + if (empty($result)) { |
|
89 | + throw new UserError(__('The object failed to update but no error was provided', 'event_espresso')); |
|
90 | + } |
|
91 | + |
|
92 | + if (! empty($datetimes)) { |
|
93 | + TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
94 | + } |
|
95 | + |
|
96 | + return [ |
|
97 | + 'id' => $id, |
|
98 | + ]; |
|
99 | + }; |
|
100 | + } |
|
101 | 101 | } |
@@ -21,81 +21,81 @@ |
||
21 | 21 | class DatetimeUpdate |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Defines the mutation data modification closure. |
|
26 | - * |
|
27 | - * @param EEM_Datetime $model |
|
28 | - * @param Datetime $type |
|
29 | - * @return callable |
|
30 | - */ |
|
31 | - public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
32 | - { |
|
33 | - /** |
|
34 | - * Updates an entity. |
|
35 | - * |
|
36 | - * @param array $input The input for the mutation |
|
37 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
38 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
39 | - * @return array |
|
40 | - * @throws UserError |
|
41 | - * @throws ReflectionException |
|
42 | - * @throws InvalidArgumentException |
|
43 | - * @throws InvalidInterfaceException |
|
44 | - * @throws InvalidDataTypeException |
|
45 | - * @throws EE_Error |
|
46 | - */ |
|
47 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
48 | - /** |
|
49 | - * Stop now if a user isn't allowed to create a datetime. |
|
50 | - */ |
|
51 | - if (! current_user_can('ee_edit_events')) { |
|
52 | - // translators: the %1$s is the name of the object being mutated |
|
53 | - throw new UserError( |
|
54 | - sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name()) |
|
55 | - ); |
|
56 | - } |
|
57 | - $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
58 | - |
|
59 | - $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
60 | - $entity = null; |
|
61 | - |
|
62 | - if ($id) { |
|
63 | - $entity = $model->get_one_by_ID($id); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * If there's no existing datetime, throw an exception |
|
68 | - */ |
|
69 | - if (! $id || ! ($entity instanceof EE_Datetime)) { |
|
70 | - // translators: the placeholder is the name of the type being updated |
|
71 | - throw new UserError( |
|
72 | - sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name()) |
|
73 | - ); |
|
74 | - } |
|
75 | - |
|
76 | - $tickets = []; |
|
77 | - |
|
78 | - $args = DatetimeMutation::prepareFields($input); |
|
79 | - |
|
80 | - if (isset($args['tickets'])) { |
|
81 | - $tickets = $args['tickets']; |
|
82 | - unset($args['tickets']); |
|
83 | - } |
|
84 | - |
|
85 | - // Update the entity |
|
86 | - $result = $entity->save($args); |
|
87 | - |
|
88 | - if (empty($result)) { |
|
89 | - throw new UserError(__('The object failed to update but no error was provided', 'event_espresso')); |
|
90 | - } |
|
91 | - |
|
92 | - if (! empty($tickets)) { |
|
93 | - DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
94 | - } |
|
95 | - |
|
96 | - return [ |
|
97 | - 'id' => $id, |
|
98 | - ]; |
|
99 | - }; |
|
100 | - } |
|
24 | + /** |
|
25 | + * Defines the mutation data modification closure. |
|
26 | + * |
|
27 | + * @param EEM_Datetime $model |
|
28 | + * @param Datetime $type |
|
29 | + * @return callable |
|
30 | + */ |
|
31 | + public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
32 | + { |
|
33 | + /** |
|
34 | + * Updates an entity. |
|
35 | + * |
|
36 | + * @param array $input The input for the mutation |
|
37 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
38 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
39 | + * @return array |
|
40 | + * @throws UserError |
|
41 | + * @throws ReflectionException |
|
42 | + * @throws InvalidArgumentException |
|
43 | + * @throws InvalidInterfaceException |
|
44 | + * @throws InvalidDataTypeException |
|
45 | + * @throws EE_Error |
|
46 | + */ |
|
47 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
48 | + /** |
|
49 | + * Stop now if a user isn't allowed to create a datetime. |
|
50 | + */ |
|
51 | + if (! current_user_can('ee_edit_events')) { |
|
52 | + // translators: the %1$s is the name of the object being mutated |
|
53 | + throw new UserError( |
|
54 | + sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name()) |
|
55 | + ); |
|
56 | + } |
|
57 | + $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
58 | + |
|
59 | + $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
60 | + $entity = null; |
|
61 | + |
|
62 | + if ($id) { |
|
63 | + $entity = $model->get_one_by_ID($id); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * If there's no existing datetime, throw an exception |
|
68 | + */ |
|
69 | + if (! $id || ! ($entity instanceof EE_Datetime)) { |
|
70 | + // translators: the placeholder is the name of the type being updated |
|
71 | + throw new UserError( |
|
72 | + sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name()) |
|
73 | + ); |
|
74 | + } |
|
75 | + |
|
76 | + $tickets = []; |
|
77 | + |
|
78 | + $args = DatetimeMutation::prepareFields($input); |
|
79 | + |
|
80 | + if (isset($args['tickets'])) { |
|
81 | + $tickets = $args['tickets']; |
|
82 | + unset($args['tickets']); |
|
83 | + } |
|
84 | + |
|
85 | + // Update the entity |
|
86 | + $result = $entity->save($args); |
|
87 | + |
|
88 | + if (empty($result)) { |
|
89 | + throw new UserError(__('The object failed to update but no error was provided', 'event_espresso')); |
|
90 | + } |
|
91 | + |
|
92 | + if (! empty($tickets)) { |
|
93 | + DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
94 | + } |
|
95 | + |
|
96 | + return [ |
|
97 | + 'id' => $id, |
|
98 | + ]; |
|
99 | + }; |
|
100 | + } |
|
101 | 101 | } |
@@ -20,68 +20,68 @@ |
||
20 | 20 | class DatetimeDelete |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Defines the mutation data modification closure. |
|
25 | - * |
|
26 | - * @param EEM_Datetime $model |
|
27 | - * @param Datetime $type |
|
28 | - * @return callable |
|
29 | - */ |
|
30 | - public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
31 | - { |
|
32 | - /** |
|
33 | - * Deletes an entity. |
|
34 | - * |
|
35 | - * @param array $input The input for the mutation |
|
36 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
37 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
38 | - * @return array |
|
39 | - * @throws UserError |
|
40 | - * @throws ReflectionException |
|
41 | - * @throws InvalidArgumentException |
|
42 | - * @throws InvalidInterfaceException |
|
43 | - * @throws InvalidDataTypeException |
|
44 | - * @throws EE_Error |
|
45 | - */ |
|
46 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
47 | - /** |
|
48 | - * Stop now if a user isn't allowed to create a datetime. |
|
49 | - */ |
|
50 | - if (! current_user_can('ee_edit_events')) { |
|
51 | - // translators: the %1$s is the name of the object being mutated |
|
52 | - throw new UserError( |
|
53 | - sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name()) |
|
54 | - ); |
|
55 | - } |
|
56 | - $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
23 | + /** |
|
24 | + * Defines the mutation data modification closure. |
|
25 | + * |
|
26 | + * @param EEM_Datetime $model |
|
27 | + * @param Datetime $type |
|
28 | + * @return callable |
|
29 | + */ |
|
30 | + public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
|
31 | + { |
|
32 | + /** |
|
33 | + * Deletes an entity. |
|
34 | + * |
|
35 | + * @param array $input The input for the mutation |
|
36 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
37 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
38 | + * @return array |
|
39 | + * @throws UserError |
|
40 | + * @throws ReflectionException |
|
41 | + * @throws InvalidArgumentException |
|
42 | + * @throws InvalidInterfaceException |
|
43 | + * @throws InvalidDataTypeException |
|
44 | + * @throws EE_Error |
|
45 | + */ |
|
46 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
47 | + /** |
|
48 | + * Stop now if a user isn't allowed to create a datetime. |
|
49 | + */ |
|
50 | + if (! current_user_can('ee_edit_events')) { |
|
51 | + // translators: the %1$s is the name of the object being mutated |
|
52 | + throw new UserError( |
|
53 | + sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name()) |
|
54 | + ); |
|
55 | + } |
|
56 | + $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
57 | 57 | |
58 | - $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
59 | - $entity = null; |
|
58 | + $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
59 | + $entity = null; |
|
60 | 60 | |
61 | - if ($id) { |
|
62 | - $entity = $model->get_one_by_ID($id); |
|
63 | - } |
|
61 | + if ($id) { |
|
62 | + $entity = $model->get_one_by_ID($id); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * If there's no existing datetime, throw an exception |
|
67 | - */ |
|
68 | - if (! $id || ! ($entity instanceof EE_Datetime)) { |
|
69 | - // translators: the placeholder is the name of the type being updated |
|
70 | - throw new UserError( |
|
71 | - sprintf(__('No %1$s could be found to delete', 'event_espresso'), $type->name()) |
|
72 | - ); |
|
73 | - } |
|
65 | + /** |
|
66 | + * If there's no existing datetime, throw an exception |
|
67 | + */ |
|
68 | + if (! $id || ! ($entity instanceof EE_Datetime)) { |
|
69 | + // translators: the placeholder is the name of the type being updated |
|
70 | + throw new UserError( |
|
71 | + sprintf(__('No %1$s could be found to delete', 'event_espresso'), $type->name()) |
|
72 | + ); |
|
73 | + } |
|
74 | 74 | |
75 | - // Delete the entity |
|
76 | - $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
75 | + // Delete the entity |
|
76 | + $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
77 | 77 | |
78 | - if (empty($result)) { |
|
79 | - throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso')); |
|
80 | - } |
|
78 | + if (empty($result)) { |
|
79 | + throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso')); |
|
80 | + } |
|
81 | 81 | |
82 | - return [ |
|
83 | - 'deleted' => $entity, |
|
84 | - ]; |
|
85 | - }; |
|
86 | - } |
|
82 | + return [ |
|
83 | + 'deleted' => $entity, |
|
84 | + ]; |
|
85 | + }; |
|
86 | + } |
|
87 | 87 | } |
@@ -20,74 +20,74 @@ |
||
20 | 20 | class TicketDelete |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Defines the mutation data modification closure. |
|
25 | - * |
|
26 | - * @param EEM_Ticket $model |
|
27 | - * @param Ticket $type |
|
28 | - * @return callable |
|
29 | - */ |
|
30 | - public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
31 | - { |
|
32 | - /** |
|
33 | - * Deletes an entity. |
|
34 | - * |
|
35 | - * @param array $input The input for the mutation |
|
36 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
37 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
38 | - * @return array |
|
39 | - * @throws UserError |
|
40 | - * @throws ReflectionException |
|
41 | - * @throws InvalidArgumentException |
|
42 | - * @throws InvalidInterfaceException |
|
43 | - * @throws InvalidDataTypeException |
|
44 | - * @throws EE_Error |
|
45 | - */ |
|
46 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
47 | - /** |
|
48 | - * Stop now if a user isn't allowed to create a datetime. |
|
49 | - */ |
|
50 | - if (! current_user_can('ee_edit_events')) { |
|
51 | - // translators: the %1$s is the name of the object being mutated |
|
52 | - throw new UserError( |
|
53 | - sprintf( |
|
54 | - __('Sorry, you are not allowed to edit %1$s', 'event_espresso'), |
|
55 | - $type->name() |
|
56 | - ) |
|
57 | - ); |
|
58 | - } |
|
59 | - $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
23 | + /** |
|
24 | + * Defines the mutation data modification closure. |
|
25 | + * |
|
26 | + * @param EEM_Ticket $model |
|
27 | + * @param Ticket $type |
|
28 | + * @return callable |
|
29 | + */ |
|
30 | + public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
31 | + { |
|
32 | + /** |
|
33 | + * Deletes an entity. |
|
34 | + * |
|
35 | + * @param array $input The input for the mutation |
|
36 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
37 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
38 | + * @return array |
|
39 | + * @throws UserError |
|
40 | + * @throws ReflectionException |
|
41 | + * @throws InvalidArgumentException |
|
42 | + * @throws InvalidInterfaceException |
|
43 | + * @throws InvalidDataTypeException |
|
44 | + * @throws EE_Error |
|
45 | + */ |
|
46 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
47 | + /** |
|
48 | + * Stop now if a user isn't allowed to create a datetime. |
|
49 | + */ |
|
50 | + if (! current_user_can('ee_edit_events')) { |
|
51 | + // translators: the %1$s is the name of the object being mutated |
|
52 | + throw new UserError( |
|
53 | + sprintf( |
|
54 | + __('Sorry, you are not allowed to edit %1$s', 'event_espresso'), |
|
55 | + $type->name() |
|
56 | + ) |
|
57 | + ); |
|
58 | + } |
|
59 | + $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null; |
|
60 | 60 | |
61 | - $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
62 | - $entity = null; |
|
61 | + $id = ! empty($id_parts['id']) ? absint($id_parts['id']) : 0; |
|
62 | + $entity = null; |
|
63 | 63 | |
64 | - if ($id) { |
|
65 | - $entity = $model->get_one_by_ID($id); |
|
66 | - } |
|
64 | + if ($id) { |
|
65 | + $entity = $model->get_one_by_ID($id); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * If there's no existing datetime, throw an exception |
|
70 | - */ |
|
71 | - if (! $id || ! ($entity instanceof EE_Ticket)) { |
|
72 | - // translators: the placeholder is the name of the type being updated |
|
73 | - throw new UserError( |
|
74 | - sprintf( |
|
75 | - __('No %1$s could be found to delete', 'event_espresso'), |
|
76 | - $type->name() |
|
77 | - ) |
|
78 | - ); |
|
79 | - } |
|
68 | + /** |
|
69 | + * If there's no existing datetime, throw an exception |
|
70 | + */ |
|
71 | + if (! $id || ! ($entity instanceof EE_Ticket)) { |
|
72 | + // translators: the placeholder is the name of the type being updated |
|
73 | + throw new UserError( |
|
74 | + sprintf( |
|
75 | + __('No %1$s could be found to delete', 'event_espresso'), |
|
76 | + $type->name() |
|
77 | + ) |
|
78 | + ); |
|
79 | + } |
|
80 | 80 | |
81 | - // Delete the entity |
|
82 | - $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
81 | + // Delete the entity |
|
82 | + $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
83 | 83 | |
84 | - if (empty($result)) { |
|
85 | - throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso')); |
|
86 | - } |
|
84 | + if (empty($result)) { |
|
85 | + throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso')); |
|
86 | + } |
|
87 | 87 | |
88 | - return [ |
|
89 | - 'deleted' => $entity, |
|
90 | - ]; |
|
91 | - }; |
|
92 | - } |
|
88 | + return [ |
|
89 | + 'deleted' => $entity, |
|
90 | + ]; |
|
91 | + }; |
|
92 | + } |
|
93 | 93 | } |