@@ -12,46 +12,46 @@ |
||
| 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 | - |
|
| 35 | - /** @var EE_Ticket $entity */ |
|
| 36 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 37 | - |
|
| 38 | - // Delete the entity |
|
| 39 | - $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
| 40 | - EntityMutator::validateResults($result); |
|
| 41 | - |
|
| 42 | - } catch (Exception $exception) { |
|
| 43 | - return EntityMutator::FormatException( |
|
| 44 | - $exception, |
|
| 45 | - esc_html__( |
|
| 46 | - 'The ticket could not be deleted because of the following error(s)', |
|
| 47 | - 'event_espresso' |
|
| 48 | - ) |
|
| 49 | - ); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - return [ |
|
| 53 | - 'deleted' => $entity, |
|
| 54 | - ]; |
|
| 55 | - }; |
|
| 56 | - } |
|
| 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 | + |
|
| 35 | + /** @var EE_Ticket $entity */ |
|
| 36 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 37 | + |
|
| 38 | + // Delete the entity |
|
| 39 | + $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
| 40 | + EntityMutator::validateResults($result); |
|
| 41 | + |
|
| 42 | + } catch (Exception $exception) { |
|
| 43 | + return EntityMutator::FormatException( |
|
| 44 | + $exception, |
|
| 45 | + esc_html__( |
|
| 46 | + 'The ticket could not be deleted because of the following error(s)', |
|
| 47 | + 'event_espresso' |
|
| 48 | + ) |
|
| 49 | + ); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + return [ |
|
| 53 | + 'deleted' => $entity, |
|
| 54 | + ]; |
|
| 55 | + }; |
|
| 56 | + } |
|
| 57 | 57 | } |
@@ -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 | |
| 35 | 35 | /** @var EE_Ticket $entity */ |
@@ -12,46 +12,46 @@ |
||
| 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 |
|
| 31 | - */ |
|
| 32 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
| 33 | - try { |
|
| 34 | - |
|
| 35 | - /** @var EE_Datetime $entity */ |
|
| 36 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 37 | - |
|
| 38 | - // Delete the entity |
|
| 39 | - $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
| 40 | - EntityMutator::validateResults($result); |
|
| 41 | - |
|
| 42 | - } catch (Exception $exception) { |
|
| 43 | - return EntityMutator::FormatException( |
|
| 44 | - $exception, |
|
| 45 | - esc_html__( |
|
| 46 | - 'The datetime could not be deleted because of the following error(s)', |
|
| 47 | - 'event_espresso' |
|
| 48 | - ) |
|
| 49 | - ); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - return [ |
|
| 53 | - 'deleted' => $entity, |
|
| 54 | - ]; |
|
| 55 | - }; |
|
| 56 | - } |
|
| 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 |
|
| 31 | + */ |
|
| 32 | + return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) { |
|
| 33 | + try { |
|
| 34 | + |
|
| 35 | + /** @var EE_Datetime $entity */ |
|
| 36 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 37 | + |
|
| 38 | + // Delete the entity |
|
| 39 | + $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
|
| 40 | + EntityMutator::validateResults($result); |
|
| 41 | + |
|
| 42 | + } catch (Exception $exception) { |
|
| 43 | + return EntityMutator::FormatException( |
|
| 44 | + $exception, |
|
| 45 | + esc_html__( |
|
| 46 | + 'The datetime could not be deleted because of the following error(s)', |
|
| 47 | + 'event_espresso' |
|
| 48 | + ) |
|
| 49 | + ); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + return [ |
|
| 53 | + 'deleted' => $entity, |
|
| 54 | + ]; |
|
| 55 | + }; |
|
| 56 | + } |
|
| 57 | 57 | } |
@@ -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 | |
| 35 | 35 | /** @var EE_Datetime $entity */ |
@@ -13,65 +13,65 @@ |
||
| 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 { |
|
| 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 | 35 | |
| 36 | - /** @var EE_Ticket $entity */ |
|
| 37 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 36 | + /** @var EE_Ticket $entity */ |
|
| 37 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 38 | 38 | |
| 39 | - $datetimes = []; |
|
| 40 | - $prices = []; |
|
| 39 | + $datetimes = []; |
|
| 40 | + $prices = []; |
|
| 41 | 41 | |
| 42 | - $args = TicketMutation::prepareFields($input); |
|
| 42 | + $args = TicketMutation::prepareFields($input); |
|
| 43 | 43 | |
| 44 | - if (isset($args['datetimes'])) { |
|
| 45 | - $datetimes = $args['datetimes']; |
|
| 46 | - unset($args['datetimes']); |
|
| 47 | - } |
|
| 48 | - if (isset($args['prices'])) { |
|
| 49 | - $prices = $args['prices']; |
|
| 50 | - unset($args['prices']); |
|
| 51 | - } |
|
| 44 | + if (isset($args['datetimes'])) { |
|
| 45 | + $datetimes = $args['datetimes']; |
|
| 46 | + unset($args['datetimes']); |
|
| 47 | + } |
|
| 48 | + if (isset($args['prices'])) { |
|
| 49 | + $prices = $args['prices']; |
|
| 50 | + unset($args['prices']); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - $entity->save($args); |
|
| 53 | + $entity->save($args); |
|
| 54 | 54 | |
| 55 | - if (! empty($datetimes)) { |
|
| 56 | - TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
| 57 | - } |
|
| 58 | - if (! empty($prices)) { |
|
| 59 | - TicketMutation::setRelatedPrices($entity, $prices); |
|
| 60 | - } |
|
| 55 | + if (! empty($datetimes)) { |
|
| 56 | + TicketMutation::setRelatedDatetimes($entity, $datetimes); |
|
| 57 | + } |
|
| 58 | + if (! empty($prices)) { |
|
| 59 | + TicketMutation::setRelatedPrices($entity, $prices); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - } catch (Exception $exception) { |
|
| 63 | - return EntityMutator::FormatException( |
|
| 64 | - $exception, |
|
| 65 | - esc_html__( |
|
| 66 | - 'The ticket could not be deleted because of the following error(s)', |
|
| 67 | - 'event_espresso' |
|
| 68 | - ) |
|
| 69 | - ); |
|
| 70 | - } |
|
| 62 | + } catch (Exception $exception) { |
|
| 63 | + return EntityMutator::FormatException( |
|
| 64 | + $exception, |
|
| 65 | + esc_html__( |
|
| 66 | + 'The ticket could not be deleted because of the following error(s)', |
|
| 67 | + 'event_espresso' |
|
| 68 | + ) |
|
| 69 | + ); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return [ |
|
| 73 | - 'id' => $entity->ID(), |
|
| 74 | - ]; |
|
| 75 | - }; |
|
| 76 | - } |
|
| 72 | + return [ |
|
| 73 | + 'id' => $entity->ID(), |
|
| 74 | + ]; |
|
| 75 | + }; |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -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 | /** @var EE_Ticket $entity */ |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $entity->save($args); |
| 54 | 54 | |
| 55 | - if (! empty($datetimes)) { |
|
| 55 | + if ( ! empty($datetimes)) { |
|
| 56 | 56 | TicketMutation::setRelatedDatetimes($entity, $datetimes); |
| 57 | 57 | } |
| 58 | - if (! empty($prices)) { |
|
| 58 | + if ( ! empty($prices)) { |
|
| 59 | 59 | TicketMutation::setRelatedPrices($entity, $prices); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -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 { |
|
| 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 | 35 | |
| 36 | - /** @var EE_Datetime $entity */ |
|
| 37 | - $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 36 | + /** @var EE_Datetime $entity */ |
|
| 37 | + $entity = EntityMutator::getEntityFromInputData($model, $input); |
|
| 38 | 38 | |
| 39 | - $tickets = []; |
|
| 40 | - $args = DatetimeMutation::prepareFields($input); |
|
| 39 | + $tickets = []; |
|
| 40 | + $args = DatetimeMutation::prepareFields($input); |
|
| 41 | 41 | |
| 42 | - if (isset($args['tickets'])) { |
|
| 43 | - $tickets = $args['tickets']; |
|
| 44 | - unset($args['tickets']); |
|
| 45 | - } |
|
| 42 | + if (isset($args['tickets'])) { |
|
| 43 | + $tickets = $args['tickets']; |
|
| 44 | + unset($args['tickets']); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - // Update the entity |
|
| 48 | - $entity->save($args); |
|
| 47 | + // Update the entity |
|
| 48 | + $entity->save($args); |
|
| 49 | 49 | |
| 50 | - if (! empty($tickets)) { |
|
| 51 | - DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
| 52 | - } |
|
| 50 | + if (! empty($tickets)) { |
|
| 51 | + DatetimeMutation::setRelatedTickets($entity, $tickets); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - } catch (Exception $exception) { |
|
| 55 | - return EntityMutator::FormatException( |
|
| 56 | - $exception, |
|
| 57 | - esc_html__( |
|
| 58 | - 'The datetime could not be updated because of the following error(s)', |
|
| 59 | - 'event_espresso' |
|
| 60 | - ) |
|
| 61 | - ); |
|
| 62 | - } |
|
| 54 | + } catch (Exception $exception) { |
|
| 55 | + return EntityMutator::FormatException( |
|
| 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 | |
| 36 | 36 | /** @var EE_Datetime $entity */ |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | // Update the entity |
| 48 | 48 | $entity->save($args); |
| 49 | 49 | |
| 50 | - if (! empty($tickets)) { |
|
| 50 | + if ( ! empty($tickets)) { |
|
| 51 | 51 | DatetimeMutation::setRelatedTickets($entity, $tickets); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -14,60 +14,60 @@ |
||
| 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 | - } catch (Exception $exception) { |
|
| 63 | - return EntityMutator::FormatException( |
|
| 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 | - } |
|
| 62 | + } catch (Exception $exception) { |
|
| 63 | + return EntityMutator::FormatException( |
|
| 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 | return; |
| 53 | 53 | } |