Completed
Branch EDTR/db-error-messages (adc1b4)
by
unknown
25:30 queued 16:43
created
core/domain/services/graphql/mutators/TicketDelete.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,46 +12,46 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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 */
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/DatetimeDelete.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,46 +12,46 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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 */
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/TicketUpdate.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -13,65 +13,65 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/DatetimeUpdate.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -13,57 +13,57 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/EventUpdate.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -14,60 +14,60 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.