Conditions | 2 |
Paths | 1 |
Total Lines | 38 |
Lines | 38 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
20 | public static function mutateAndGetPayload(EEM_Form_Section $model) |
||
21 | { |
||
22 | /** |
||
23 | * Deletes an entity. |
||
24 | * |
||
25 | * @param array $input The input for the mutation |
||
26 | * @param AppContext $context The AppContext passed down to all resolvers |
||
27 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
||
28 | * @return array |
||
29 | */ |
||
30 | return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array { |
||
31 | try { |
||
32 | /** @var EE_Form_Section $entity */ |
||
33 | $entity = EntityMutator::getEntityFromInputData($model, $input); |
||
34 | |||
35 | $result = $entity->delete(); |
||
36 | EntityMutator::validateResults($result); |
||
37 | |||
38 | do_action( |
||
39 | 'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_section_delete', |
||
40 | $entity, |
||
41 | $input |
||
42 | ); |
||
43 | } catch (Exception $exception) { |
||
44 | EntityMutator::handleExceptions( |
||
45 | $exception, |
||
46 | esc_html__( |
||
47 | 'The form section could not be deleted because of the following error(s)', |
||
48 | 'event_espresso' |
||
49 | ) |
||
50 | ); |
||
51 | } |
||
52 | |||
53 | return [ |
||
54 | 'deleted' => $entity, |
||
55 | ]; |
||
56 | }; |
||
57 | } |
||
58 | } |
||
59 |