Completed
Branch dev (08e10f)
by
unknown
12:20 queued 10:12
created
core/domain/services/graphql/enums/TicketsConnectionOrderbyEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct()
22 22
     {
23
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
23
+        $this->setName($this->namespace.'TicketsConnectionOrderbyEnum');
24 24
         $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25 25
         parent::__construct();
26 26
     }
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 class TicketsConnectionOrderbyEnum extends EnumBase
16 16
 {
17 17
 
18
-    /**
19
-     * TicketsConnectionOrderbyEnum constructor.
20
-     */
21
-    public function __construct()
22
-    {
23
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
24
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25
-        parent::__construct();
26
-    }
18
+	/**
19
+	 * TicketsConnectionOrderbyEnum constructor.
20
+	 */
21
+	public function __construct()
22
+	{
23
+		$this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
24
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    protected function getValues(): array
33
-    {
34
-        return [
35
-            'NAME'     => [
36
-                'value'       => 'TKT_name',
37
-                'description' => esc_html__('Order by name', 'event_espresso'),
38
-            ],
39
-            'START_DATE'     => [
40
-                'value'       => 'TKT_start_date',
41
-                'description' => esc_html__('Order by start date', 'event_espresso'),
42
-            ],
43
-        ];
44
-    }
29
+	/**
30
+	 * @return array
31
+	 */
32
+	protected function getValues(): array
33
+	{
34
+		return [
35
+			'NAME'     => [
36
+				'value'       => 'TKT_name',
37
+				'description' => esc_html__('Order by name', 'event_espresso'),
38
+			],
39
+			'START_DATE'     => [
40
+				'value'       => 'TKT_start_date',
41
+				'description' => esc_html__('Order by start date', 'event_espresso'),
42
+			],
43
+		];
44
+	}
45 45
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/PriceBaseTypeEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function __construct()
23 23
     {
24
-        $this->setName($this->namespace . 'PriceBaseTypeEnum');
24
+        $this->setName($this->namespace.'PriceBaseTypeEnum');
25 25
         $this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
26 26
         parent::__construct();
27 27
     }
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -16,35 +16,35 @@
 block discarded – undo
16 16
 class PriceBaseTypeEnum extends EnumBase
17 17
 {
18 18
 
19
-    /**
20
-     * PriceBaseTypeEnum constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'PriceBaseTypeEnum');
25
-        $this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * PriceBaseTypeEnum constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'PriceBaseTypeEnum');
25
+		$this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return array
32
-     */
33
-    protected function getValues(): array
34
-    {
35
-        return [
36
-            'BASE_PRICE'     => [
37
-                'value'       => EEM_Price_Type::base_type_base_price,
38
-            ],
39
-            'DISCOUNT'     => [
40
-                'value'       => EEM_Price_Type::base_type_discount,
41
-            ],
42
-            'SURCHARGE'     => [
43
-                'value'       => EEM_Price_Type::base_type_surcharge,
44
-            ],
45
-            'TAX'     => [
46
-                'value'       => EEM_Price_Type::base_type_tax,
47
-            ],
48
-        ];
49
-    }
30
+	/**
31
+	 * @return array
32
+	 */
33
+	protected function getValues(): array
34
+	{
35
+		return [
36
+			'BASE_PRICE'     => [
37
+				'value'       => EEM_Price_Type::base_type_base_price,
38
+			],
39
+			'DISCOUNT'     => [
40
+				'value'       => EEM_Price_Type::base_type_discount,
41
+			],
42
+			'SURCHARGE'     => [
43
+				'value'       => EEM_Price_Type::base_type_surcharge,
44
+			],
45
+			'TAX'     => [
46
+				'value'       => EEM_Price_Type::base_type_tax,
47
+			],
48
+		];
49
+	}
50 50
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/inputs/DatetimesConnectionOrderbyInput.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function __construct()
26 26
     {
27
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
27
+        $this->setName($this->namespace.'DatetimesConnectionOrderbyInput');
28 28
         $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
29 29
         parent::__construct();
30 30
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         return [
40 40
             new GraphQLField(
41 41
                 'field',
42
-                ['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
42
+                ['non_null' => $this->namespace.'DatetimesConnectionOrderbyEnum']
43 43
             ),
44 44
             new GraphQLField(
45 45
                 'order',
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@
 block discarded – undo
17 17
 class DatetimesConnectionOrderbyInput extends InputBase
18 18
 {
19 19
 
20
-    /**
21
-     * DatetimesConnectionOrderbyInput constructor.
22
-     */
23
-    public function __construct()
24
-    {
25
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
26
-        $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27
-        parent::__construct();
28
-    }
20
+	/**
21
+	 * DatetimesConnectionOrderbyInput constructor.
22
+	 */
23
+	public function __construct()
24
+	{
25
+		$this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
26
+		$this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27
+		parent::__construct();
28
+	}
29 29
 
30 30
 
31
-    /**
32
-     * @return GraphQLFieldInterface[]
33
-     */
34
-    protected function getFields(): array
35
-    {
36
-        return [
37
-            new GraphQLField(
38
-                'field',
39
-                ['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
40
-            ),
41
-            new GraphQLField(
42
-                'order',
43
-                'OrderEnum'
44
-            ),
45
-        ];
46
-    }
31
+	/**
32
+	 * @return GraphQLFieldInterface[]
33
+	 */
34
+	protected function getFields(): array
35
+	{
36
+		return [
37
+			new GraphQLField(
38
+				'field',
39
+				['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
40
+			),
41
+			new GraphQLField(
42
+				'order',
43
+				'OrderEnum'
44
+			),
45
+		];
46
+	}
47 47
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/inputs/TicketsConnectionOrderbyInput.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function __construct()
26 26
     {
27
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyInput');
27
+        $this->setName($this->namespace.'TicketsConnectionOrderbyInput');
28 28
         $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
29 29
         parent::__construct();
30 30
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         return [
40 40
             new GraphQLField(
41 41
                 'field',
42
-                ['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum']
42
+                ['non_null' => $this->namespace.'TicketsConnectionOrderbyEnum']
43 43
             ),
44 44
             new GraphQLField(
45 45
                 'order',
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@
 block discarded – undo
17 17
 class TicketsConnectionOrderbyInput extends InputBase
18 18
 {
19 19
 
20
-    /**
21
-     * TicketsConnectionOrderbyInput constructor.
22
-     */
23
-    public function __construct()
24
-    {
25
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyInput');
26
-        $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27
-        parent::__construct();
28
-    }
20
+	/**
21
+	 * TicketsConnectionOrderbyInput constructor.
22
+	 */
23
+	public function __construct()
24
+	{
25
+		$this->setName($this->namespace . 'TicketsConnectionOrderbyInput');
26
+		$this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27
+		parent::__construct();
28
+	}
29 29
 
30 30
 
31
-    /**
32
-     * @return GraphQLFieldInterface[]
33
-     */
34
-    protected function getFields(): array
35
-    {
36
-        return [
37
-            new GraphQLField(
38
-                'field',
39
-                ['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum']
40
-            ),
41
-            new GraphQLField(
42
-                'order',
43
-                'OrderEnum'
44
-            ),
45
-        ];
46
-    }
31
+	/**
32
+	 * @return GraphQLFieldInterface[]
33
+	 */
34
+	protected function getFields(): array
35
+	{
36
+		return [
37
+			new GraphQLField(
38
+				'field',
39
+				['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum']
40
+			),
41
+			new GraphQLField(
42
+				'order',
43
+				'OrderEnum'
44
+			),
45
+		];
46
+	}
47 47
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/RootQueryPricesConnection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         return [
40 40
             'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Price',
42
-            'fromFieldName'      => lcfirst($this->namespace) . 'Prices',
41
+            'toType'             => $this->namespace.'Price',
42
+            'fromFieldName'      => lcfirst($this->namespace).'Prices',
43 43
             'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection",
44 44
             'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45 45
             'resolve'            => [$this, 'resolveConnection'],
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,43 +20,43 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * PriceConnection constructor.
25
-     *
26
-     * @param EEM_Price               $model
27
-     */
28
-    public function __construct(EEM_Price $model)
29
-    {
30
-        parent::__construct($model);
31
-    }
32
-
33
-
34
-    /**
35
-     * @return array
36
-     */
37
-    public function config(): array
38
-    {
39
-        return [
40
-            'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Price',
42
-            'fromFieldName'      => lcfirst($this->namespace) . 'Prices',
43
-            'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection",
44
-            'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45
-            'resolve'            => [$this, 'resolveConnection'],
46
-        ];
47
-    }
48
-
49
-
50
-    /**
51
-     * @param $entity
52
-     * @param $args
53
-     * @param $context
54
-     * @param $info
55
-     * @return PriceConnectionResolver
56
-     * @throws Exception
57
-     */
58
-    public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
59
-    {
60
-        return new PriceConnectionResolver($entity, $args, $context, $info);
61
-    }
23
+	/**
24
+	 * PriceConnection constructor.
25
+	 *
26
+	 * @param EEM_Price               $model
27
+	 */
28
+	public function __construct(EEM_Price $model)
29
+	{
30
+		parent::__construct($model);
31
+	}
32
+
33
+
34
+	/**
35
+	 * @return array
36
+	 */
37
+	public function config(): array
38
+	{
39
+		return [
40
+			'fromType'           => 'RootQuery',
41
+			'toType'             => $this->namespace . 'Price',
42
+			'fromFieldName'      => lcfirst($this->namespace) . 'Prices',
43
+			'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection",
44
+			'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45
+			'resolve'            => [$this, 'resolveConnection'],
46
+		];
47
+	}
48
+
49
+
50
+	/**
51
+	 * @param $entity
52
+	 * @param $args
53
+	 * @param $context
54
+	 * @param $info
55
+	 * @return PriceConnectionResolver
56
+	 * @throws Exception
57
+	 */
58
+	public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
59
+	{
60
+		return new PriceConnectionResolver($entity, $args, $context, $info);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/RootQueryDatetimesConnection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         return [
40 40
             'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Datetime',
42
-            'fromFieldName'      => lcfirst($this->namespace . 'Datetimes'),
41
+            'toType'             => $this->namespace.'Datetime',
42
+            'fromFieldName'      => lcfirst($this->namespace.'Datetimes'),
43 43
             'connectionTypeName' => "{$this->namespace}RootQueryDatetimesConnection",
44 44
             'connectionArgs'     => EventDatetimesConnection::get_connection_args(),
45 45
             'resolve'            => [$this, 'resolveConnection'],
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,43 +20,43 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * DatetimeConnection constructor.
25
-     *
26
-     * @param EEM_Datetime               $model
27
-     */
28
-    public function __construct(EEM_Datetime $model)
29
-    {
30
-        parent::__construct($model);
31
-    }
32
-
33
-
34
-    /**
35
-     * @return array
36
-     */
37
-    public function config(): array
38
-    {
39
-        return [
40
-            'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Datetime',
42
-            'fromFieldName'      => lcfirst($this->namespace . 'Datetimes'),
43
-            'connectionTypeName' => "{$this->namespace}RootQueryDatetimesConnection",
44
-            'connectionArgs'     => EventDatetimesConnection::get_connection_args(),
45
-            'resolve'            => [$this, 'resolveConnection'],
46
-        ];
47
-    }
48
-
49
-
50
-    /**
51
-     * @param $entity
52
-     * @param $args
53
-     * @param $context
54
-     * @param $info
55
-     * @return DatetimeConnectionResolver
56
-     * @throws Exception
57
-     */
58
-    public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
59
-    {
60
-        return new DatetimeConnectionResolver($entity, $args, $context, $info);
61
-    }
23
+	/**
24
+	 * DatetimeConnection constructor.
25
+	 *
26
+	 * @param EEM_Datetime               $model
27
+	 */
28
+	public function __construct(EEM_Datetime $model)
29
+	{
30
+		parent::__construct($model);
31
+	}
32
+
33
+
34
+	/**
35
+	 * @return array
36
+	 */
37
+	public function config(): array
38
+	{
39
+		return [
40
+			'fromType'           => 'RootQuery',
41
+			'toType'             => $this->namespace . 'Datetime',
42
+			'fromFieldName'      => lcfirst($this->namespace . 'Datetimes'),
43
+			'connectionTypeName' => "{$this->namespace}RootQueryDatetimesConnection",
44
+			'connectionArgs'     => EventDatetimesConnection::get_connection_args(),
45
+			'resolve'            => [$this, 'resolveConnection'],
46
+		];
47
+	}
48
+
49
+
50
+	/**
51
+	 * @param $entity
52
+	 * @param $args
53
+	 * @param $context
54
+	 * @param $info
55
+	 * @return DatetimeConnectionResolver
56
+	 * @throws Exception
57
+	 */
58
+	public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
59
+	{
60
+		return new DatetimeConnectionResolver($entity, $args, $context, $info);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/RootQueryTicketsConnection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         return [
40 40
             'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Ticket',
42
-            'fromFieldName'      => lcfirst($this->namespace) . 'Tickets',
41
+            'toType'             => $this->namespace.'Ticket',
42
+            'fromFieldName'      => lcfirst($this->namespace).'Tickets',
43 43
             'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection",
44 44
             'connectionArgs'     => DatetimeTicketsConnection::get_connection_args(),
45 45
             'resolve'            => [$this, 'resolveConnection'],
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,43 +20,43 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * TicketConnection constructor.
25
-     *
26
-     * @param EEM_Ticket               $model
27
-     */
28
-    public function __construct(EEM_Ticket $model)
29
-    {
30
-        parent::__construct($model);
31
-    }
32
-
33
-
34
-    /**
35
-     * @return array
36
-     */
37
-    public function config(): array
38
-    {
39
-        return [
40
-            'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Ticket',
42
-            'fromFieldName'      => lcfirst($this->namespace) . 'Tickets',
43
-            'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection",
44
-            'connectionArgs'     => DatetimeTicketsConnection::get_connection_args(),
45
-            'resolve'            => [$this, 'resolveConnection'],
46
-        ];
47
-    }
48
-
49
-
50
-    /**
51
-     * @param $entity
52
-     * @param $args
53
-     * @param $context
54
-     * @param $info
55
-     * @return TicketConnectionResolver
56
-     * @throws Exception
57
-     */
58
-    public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
59
-    {
60
-        return new TicketConnectionResolver($entity, $args, $context, $info);
61
-    }
23
+	/**
24
+	 * TicketConnection constructor.
25
+	 *
26
+	 * @param EEM_Ticket               $model
27
+	 */
28
+	public function __construct(EEM_Ticket $model)
29
+	{
30
+		parent::__construct($model);
31
+	}
32
+
33
+
34
+	/**
35
+	 * @return array
36
+	 */
37
+	public function config(): array
38
+	{
39
+		return [
40
+			'fromType'           => 'RootQuery',
41
+			'toType'             => $this->namespace . 'Ticket',
42
+			'fromFieldName'      => lcfirst($this->namespace) . 'Tickets',
43
+			'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection",
44
+			'connectionArgs'     => DatetimeTicketsConnection::get_connection_args(),
45
+			'resolve'            => [$this, 'resolveConnection'],
46
+		];
47
+	}
48
+
49
+
50
+	/**
51
+	 * @param $entity
52
+	 * @param $args
53
+	 * @param $context
54
+	 * @param $info
55
+	 * @return TicketConnectionResolver
56
+	 * @throws Exception
57
+	 */
58
+	public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
59
+	{
60
+		return new TicketConnectionResolver($entity, $args, $context, $info);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
core/services/graphql/inputs/InputBase.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -16,97 +16,97 @@
 block discarded – undo
16 16
 abstract class InputBase implements InputInterface
17 17
 {
18 18
 
19
-    /**
20
-     * @var string $namespace The graphql namespace/prefix.
21
-     */
22
-    protected $namespace = 'Espresso';
23
-
24
-    /**
25
-     * @var string $name
26
-     */
27
-    protected $name = '';
28
-
29
-    /**
30
-     * @var string $description
31
-     */
32
-    protected $description = '';
33
-
34
-    /**
35
-     * @var GraphQLFieldInterface[] $fields
36
-     */
37
-    protected $fields = [];
38
-
39
-    /**
40
-     * InputBase constructor.
41
-     */
42
-    public function __construct()
43
-    {
44
-        $this->setFields($this->getFields());
45
-    }
46
-
47
-
48
-    /**
49
-     * @return GraphQLFieldInterface[]
50
-     * @since $VID:$
51
-     */
52
-    abstract protected function getFields();
53
-
54
-
55
-    /**
56
-     * @return string
57
-     */
58
-    public function name()
59
-    {
60
-        return $this->name;
61
-    }
62
-
63
-
64
-    /**
65
-     * @param string $name
66
-     */
67
-    protected function setName($name)
68
-    {
69
-        $this->name = $name;
70
-    }
71
-
72
-
73
-    /**
74
-     * @return string
75
-     */
76
-    public function description()
77
-    {
78
-        return $this->description;
79
-    }
80
-
81
-
82
-    /**
83
-     * @param string $description
84
-     */
85
-    protected function setDescription($description)
86
-    {
87
-        $this->description = $description;
88
-    }
89
-
90
-
91
-    /**
92
-     * @return GraphQLFieldInterface[]
93
-     * @since $VID:$
94
-     */
95
-    public function fields()
96
-    {
97
-        return (array) $this->fields;
98
-    }
99
-
100
-
101
-    /**
102
-     * @param GraphQLFieldInterface[] $fields
103
-     */
104
-    protected function setFields(array $fields)
105
-    {
106
-        foreach ($fields as $field) {
107
-            if ($field instanceof GraphQLField) {
108
-                $this->fields[] = $field;
109
-            }
110
-        }
111
-    }
19
+	/**
20
+	 * @var string $namespace The graphql namespace/prefix.
21
+	 */
22
+	protected $namespace = 'Espresso';
23
+
24
+	/**
25
+	 * @var string $name
26
+	 */
27
+	protected $name = '';
28
+
29
+	/**
30
+	 * @var string $description
31
+	 */
32
+	protected $description = '';
33
+
34
+	/**
35
+	 * @var GraphQLFieldInterface[] $fields
36
+	 */
37
+	protected $fields = [];
38
+
39
+	/**
40
+	 * InputBase constructor.
41
+	 */
42
+	public function __construct()
43
+	{
44
+		$this->setFields($this->getFields());
45
+	}
46
+
47
+
48
+	/**
49
+	 * @return GraphQLFieldInterface[]
50
+	 * @since $VID:$
51
+	 */
52
+	abstract protected function getFields();
53
+
54
+
55
+	/**
56
+	 * @return string
57
+	 */
58
+	public function name()
59
+	{
60
+		return $this->name;
61
+	}
62
+
63
+
64
+	/**
65
+	 * @param string $name
66
+	 */
67
+	protected function setName($name)
68
+	{
69
+		$this->name = $name;
70
+	}
71
+
72
+
73
+	/**
74
+	 * @return string
75
+	 */
76
+	public function description()
77
+	{
78
+		return $this->description;
79
+	}
80
+
81
+
82
+	/**
83
+	 * @param string $description
84
+	 */
85
+	protected function setDescription($description)
86
+	{
87
+		$this->description = $description;
88
+	}
89
+
90
+
91
+	/**
92
+	 * @return GraphQLFieldInterface[]
93
+	 * @since $VID:$
94
+	 */
95
+	public function fields()
96
+	{
97
+		return (array) $this->fields;
98
+	}
99
+
100
+
101
+	/**
102
+	 * @param GraphQLFieldInterface[] $fields
103
+	 */
104
+	protected function setFields(array $fields)
105
+	{
106
+		foreach ($fields as $field) {
107
+			if ($field instanceof GraphQLField) {
108
+				$this->fields[] = $field;
109
+			}
110
+		}
111
+	}
112 112
 }
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/ExecuteBatchDeletion.php 2 patches
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -32,158 +32,158 @@
 block discarded – undo
32 32
  */
33 33
 class ExecuteBatchDeletion extends JobHandler
34 34
 {
35
-    /**
36
-     * @var NodeGroupDao
37
-     */
38
-    protected $model_obj_node_group_persister;
39
-    public function __construct(NodeGroupDao $model_obj_node_group_persister)
40
-    {
41
-        $this->model_obj_node_group_persister = $model_obj_node_group_persister;
42
-    }
35
+	/**
36
+	 * @var NodeGroupDao
37
+	 */
38
+	protected $model_obj_node_group_persister;
39
+	public function __construct(NodeGroupDao $model_obj_node_group_persister)
40
+	{
41
+		$this->model_obj_node_group_persister = $model_obj_node_group_persister;
42
+	}
43 43
 
44 44
 
45
-    // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
46
-    /**
47
-     *
48
-     * @param JobParameters $job_parameters
49
-     * @throws BatchRequestException
50
-     * @return JobStepResponse
51
-     */
52
-    public function create_job(JobParameters $job_parameters)
53
-    {
54
-        $deletion_job_code = $job_parameters->request_datum('deletion_job_code', null);
55
-        $roots = $this->model_obj_node_group_persister->getModelObjNodesInGroup($deletion_job_code);
56
-        if ($roots === null) {
57
-            throw new UnexpectedEntityException($roots, 'array', esc_html__('The job seems to be stale. Please press the back button in your browser twice.', 'event_espresso'));
58
-        }
59
-        $models_and_ids_to_delete = [];
60
-        foreach ($roots as $root) {
61
-            if (! $root instanceof ModelObjNode) {
62
-                throw new UnexpectedEntityException($root, 'ModelObjNode');
63
-            }
64
-            $models_and_ids_to_delete = array_replace_recursive($models_and_ids_to_delete, $root->getIds());
65
-        }
66
-        $job_parameters->set_extra_data(
67
-            [
68
-                'models_and_ids_to_delete' => $models_and_ids_to_delete
69
-            ]
70
-        );
71
-        // Find the job's actual size.
72
-        $job_size = 0;
73
-        foreach ($models_and_ids_to_delete as $model_name => $ids) {
74
-            $job_size += count($ids);
75
-        }
76
-        $job_parameters->set_job_size($job_size);
77
-        return new JobStepResponse(
78
-            $job_parameters,
79
-            esc_html__('Beginning to delete items...', 'event_espresso')
80
-        );
81
-    }
45
+	// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
46
+	/**
47
+	 *
48
+	 * @param JobParameters $job_parameters
49
+	 * @throws BatchRequestException
50
+	 * @return JobStepResponse
51
+	 */
52
+	public function create_job(JobParameters $job_parameters)
53
+	{
54
+		$deletion_job_code = $job_parameters->request_datum('deletion_job_code', null);
55
+		$roots = $this->model_obj_node_group_persister->getModelObjNodesInGroup($deletion_job_code);
56
+		if ($roots === null) {
57
+			throw new UnexpectedEntityException($roots, 'array', esc_html__('The job seems to be stale. Please press the back button in your browser twice.', 'event_espresso'));
58
+		}
59
+		$models_and_ids_to_delete = [];
60
+		foreach ($roots as $root) {
61
+			if (! $root instanceof ModelObjNode) {
62
+				throw new UnexpectedEntityException($root, 'ModelObjNode');
63
+			}
64
+			$models_and_ids_to_delete = array_replace_recursive($models_and_ids_to_delete, $root->getIds());
65
+		}
66
+		$job_parameters->set_extra_data(
67
+			[
68
+				'models_and_ids_to_delete' => $models_and_ids_to_delete
69
+			]
70
+		);
71
+		// Find the job's actual size.
72
+		$job_size = 0;
73
+		foreach ($models_and_ids_to_delete as $model_name => $ids) {
74
+			$job_size += count($ids);
75
+		}
76
+		$job_parameters->set_job_size($job_size);
77
+		return new JobStepResponse(
78
+			$job_parameters,
79
+			esc_html__('Beginning to delete items...', 'event_espresso')
80
+		);
81
+	}
82 82
 
83
-    /**
84
-     * Performs another step of the job
85
-     * @param JobParameters $job_parameters
86
-     * @param int $batch_size
87
-     * @return JobStepResponse
88
-     * @throws BatchRequestException
89
-     */
90
-    public function continue_job(JobParameters $job_parameters, $batch_size = 50)
91
-    {
92
-        // We already have the items IDs. So deleting is really fast. Let's speed it up.
93
-        $batch_size *= 10;
94
-        $units_processed = 0;
95
-        $models_and_ids_to_delete = $job_parameters->extra_datum('models_and_ids_to_delete', []);
96
-        // Build a new list of everything leftover after this request's of deletions.
97
-        $models_and_ids_remaining = [];
98
-        foreach ($models_and_ids_to_delete as $model_name => $ids_to_delete) {
99
-            if ($units_processed < $batch_size) {
100
-                $model = EE_Registry::instance()->load_model($model_name);
101
-                $ids_to_delete_this_query = array_slice($ids_to_delete, 0, $batch_size - $units_processed, true);
102
-                if ($model->has_primary_key_field()) {
103
-                    $where_conditions = [
104
-                        $model->primary_key_name() => [
105
-                            'IN',
106
-                            $ids_to_delete_this_query
107
-                        ]
108
-                    ];
109
-                } else {
110
-                    $where_conditions = [
111
-                        'OR' => []
112
-                    ];
113
-                    foreach ($ids_to_delete_this_query as $index_primary_key_string) {
114
-                        $keys_n_values = $model->parse_index_primary_key_string($index_primary_key_string);
115
-                        $where_conditions['OR'][ 'AND*' . $index_primary_key_string ] = $keys_n_values;
116
-                    }
117
-                }
118
-                // Deleting time!
119
-                // The model's deletion method reports every ROW deleted, and in the case of CPT models that will be
120
-                // two rows deleted for event CPT item. So don't rely on it for the count of items deleted.
121
-                $model->delete_permanently(
122
-                    [
123
-                        $where_conditions
124
-                    ],
125
-                    false
126
-                );
127
-                $units_processed += count($ids_to_delete_this_query);
128
-                $remaining_ids = array_diff_key($ids_to_delete, $ids_to_delete_this_query);
129
-                // If there's any more from this model, we'll do them next time.
130
-                if (count($remaining_ids) > 0) {
131
-                    $models_and_ids_remaining[ $model_name ] = $remaining_ids;
132
-                }
133
-            } else {
134
-                $models_and_ids_remaining[ $model_name ] = $models_and_ids_to_delete[ $model_name ];
135
-            }
136
-        }
137
-        $job_parameters->mark_processed($units_processed);
138
-        // All done deleting for this request. Is there anything to do next time?
139
-        if (empty($models_and_ids_remaining)) {
140
-            $job_parameters->set_status(JobParameters::status_complete);
141
-            return new JobStepResponse(
142
-                $job_parameters,
143
-                esc_html__('Deletion complete.', 'event_espresso')
144
-            );
145
-        }
146
-        $job_parameters->add_extra_data('models_and_ids_to_delete', $models_and_ids_remaining);
147
-        return new JobStepResponse(
148
-            $job_parameters,
149
-            sprintf(
150
-                esc_html__('Deleted %d items.', 'event_espresso'),
151
-                $units_processed
152
-            )
153
-        );
154
-    }
83
+	/**
84
+	 * Performs another step of the job
85
+	 * @param JobParameters $job_parameters
86
+	 * @param int $batch_size
87
+	 * @return JobStepResponse
88
+	 * @throws BatchRequestException
89
+	 */
90
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50)
91
+	{
92
+		// We already have the items IDs. So deleting is really fast. Let's speed it up.
93
+		$batch_size *= 10;
94
+		$units_processed = 0;
95
+		$models_and_ids_to_delete = $job_parameters->extra_datum('models_and_ids_to_delete', []);
96
+		// Build a new list of everything leftover after this request's of deletions.
97
+		$models_and_ids_remaining = [];
98
+		foreach ($models_and_ids_to_delete as $model_name => $ids_to_delete) {
99
+			if ($units_processed < $batch_size) {
100
+				$model = EE_Registry::instance()->load_model($model_name);
101
+				$ids_to_delete_this_query = array_slice($ids_to_delete, 0, $batch_size - $units_processed, true);
102
+				if ($model->has_primary_key_field()) {
103
+					$where_conditions = [
104
+						$model->primary_key_name() => [
105
+							'IN',
106
+							$ids_to_delete_this_query
107
+						]
108
+					];
109
+				} else {
110
+					$where_conditions = [
111
+						'OR' => []
112
+					];
113
+					foreach ($ids_to_delete_this_query as $index_primary_key_string) {
114
+						$keys_n_values = $model->parse_index_primary_key_string($index_primary_key_string);
115
+						$where_conditions['OR'][ 'AND*' . $index_primary_key_string ] = $keys_n_values;
116
+					}
117
+				}
118
+				// Deleting time!
119
+				// The model's deletion method reports every ROW deleted, and in the case of CPT models that will be
120
+				// two rows deleted for event CPT item. So don't rely on it for the count of items deleted.
121
+				$model->delete_permanently(
122
+					[
123
+						$where_conditions
124
+					],
125
+					false
126
+				);
127
+				$units_processed += count($ids_to_delete_this_query);
128
+				$remaining_ids = array_diff_key($ids_to_delete, $ids_to_delete_this_query);
129
+				// If there's any more from this model, we'll do them next time.
130
+				if (count($remaining_ids) > 0) {
131
+					$models_and_ids_remaining[ $model_name ] = $remaining_ids;
132
+				}
133
+			} else {
134
+				$models_and_ids_remaining[ $model_name ] = $models_and_ids_to_delete[ $model_name ];
135
+			}
136
+		}
137
+		$job_parameters->mark_processed($units_processed);
138
+		// All done deleting for this request. Is there anything to do next time?
139
+		if (empty($models_and_ids_remaining)) {
140
+			$job_parameters->set_status(JobParameters::status_complete);
141
+			return new JobStepResponse(
142
+				$job_parameters,
143
+				esc_html__('Deletion complete.', 'event_espresso')
144
+			);
145
+		}
146
+		$job_parameters->add_extra_data('models_and_ids_to_delete', $models_and_ids_remaining);
147
+		return new JobStepResponse(
148
+			$job_parameters,
149
+			sprintf(
150
+				esc_html__('Deleted %d items.', 'event_espresso'),
151
+				$units_processed
152
+			)
153
+		);
154
+	}
155 155
 
156
-    /**
157
-     * Performs any clean-up logic when we know the job is completed
158
-     * @param JobParameters $job_parameters
159
-     * @return JobStepResponse
160
-     */
161
-    public function cleanup_job(JobParameters $job_parameters)
162
-    {
163
-        $this->model_obj_node_group_persister->deleteModelObjNodesInGroup(
164
-            $job_parameters->request_datum('deletion_job_code')
165
-        );
166
-        // For backwards compatibility with how we used to delete events, make sure we still trigger the old action.
167
-        $models_and_ids_to_delete = $job_parameters->extra_datum('models_and_ids_to_delete', []);
168
-        foreach ($models_and_ids_to_delete['Event'] as $event_id) {
169
-            // Create a log entry so we know who and when this event was permanently deleted.
170
-            (EE_Change_Log::new_instance(
171
-                [
172
-                    'OBJ_ID' => $event_id,
173
-                    'OBJ_type' => 'Event',
174
-                    'LOG_message' => sprintf(
175
-                        esc_html__('Event %1$d permanently deleted using ExecuteBatchDeletion.', 'event_espresso'),
176
-                        $event_id
177
-                    )
178
-                ]
179
-            ))->save();
180
-            do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $event_id);
181
-        }
182
-        return new JobStepResponse(
183
-            $job_parameters,
184
-            esc_html__('All done', 'event_espresso')
185
-        );
186
-    }
156
+	/**
157
+	 * Performs any clean-up logic when we know the job is completed
158
+	 * @param JobParameters $job_parameters
159
+	 * @return JobStepResponse
160
+	 */
161
+	public function cleanup_job(JobParameters $job_parameters)
162
+	{
163
+		$this->model_obj_node_group_persister->deleteModelObjNodesInGroup(
164
+			$job_parameters->request_datum('deletion_job_code')
165
+		);
166
+		// For backwards compatibility with how we used to delete events, make sure we still trigger the old action.
167
+		$models_and_ids_to_delete = $job_parameters->extra_datum('models_and_ids_to_delete', []);
168
+		foreach ($models_and_ids_to_delete['Event'] as $event_id) {
169
+			// Create a log entry so we know who and when this event was permanently deleted.
170
+			(EE_Change_Log::new_instance(
171
+				[
172
+					'OBJ_ID' => $event_id,
173
+					'OBJ_type' => 'Event',
174
+					'LOG_message' => sprintf(
175
+						esc_html__('Event %1$d permanently deleted using ExecuteBatchDeletion.', 'event_espresso'),
176
+						$event_id
177
+					)
178
+				]
179
+			))->save();
180
+			do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $event_id);
181
+		}
182
+		return new JobStepResponse(
183
+			$job_parameters,
184
+			esc_html__('All done', 'event_espresso')
185
+		);
186
+	}
187 187
 }
188 188
 // End of file EventDeletion.php
189 189
 // Location: EventEspressoBatchRequest\JobHandlers/EventDeletion.php
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         }
59 59
         $models_and_ids_to_delete = [];
60 60
         foreach ($roots as $root) {
61
-            if (! $root instanceof ModelObjNode) {
61
+            if ( ! $root instanceof ModelObjNode) {
62 62
                 throw new UnexpectedEntityException($root, 'ModelObjNode');
63 63
             }
64 64
             $models_and_ids_to_delete = array_replace_recursive($models_and_ids_to_delete, $root->getIds());
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     ];
113 113
                     foreach ($ids_to_delete_this_query as $index_primary_key_string) {
114 114
                         $keys_n_values = $model->parse_index_primary_key_string($index_primary_key_string);
115
-                        $where_conditions['OR'][ 'AND*' . $index_primary_key_string ] = $keys_n_values;
115
+                        $where_conditions['OR']['AND*'.$index_primary_key_string] = $keys_n_values;
116 116
                     }
117 117
                 }
118 118
                 // Deleting time!
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
                 $remaining_ids = array_diff_key($ids_to_delete, $ids_to_delete_this_query);
129 129
                 // If there's any more from this model, we'll do them next time.
130 130
                 if (count($remaining_ids) > 0) {
131
-                    $models_and_ids_remaining[ $model_name ] = $remaining_ids;
131
+                    $models_and_ids_remaining[$model_name] = $remaining_ids;
132 132
                 }
133 133
             } else {
134
-                $models_and_ids_remaining[ $model_name ] = $models_and_ids_to_delete[ $model_name ];
134
+                $models_and_ids_remaining[$model_name] = $models_and_ids_to_delete[$model_name];
135 135
             }
136 136
         }
137 137
         $job_parameters->mark_processed($units_processed);
Please login to merge, or discard this patch.