@@ -20,7 +20,7 @@ |
||
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 | } |
@@ -14,31 +14,31 @@ |
||
14 | 14 | */ |
15 | 15 | class TicketsConnectionOrderbyEnum extends EnumBase |
16 | 16 | { |
17 | - /** |
|
18 | - * TicketsConnectionOrderbyEnum constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->setName($this->namespace . 'TicketsConnectionOrderbyEnum'); |
|
23 | - $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
17 | + /** |
|
18 | + * TicketsConnectionOrderbyEnum constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->setName($this->namespace . 'TicketsConnectionOrderbyEnum'); |
|
23 | + $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return array |
|
30 | - */ |
|
31 | - protected function getValues(): array |
|
32 | - { |
|
33 | - return [ |
|
34 | - 'NAME' => [ |
|
35 | - 'value' => 'TKT_name', |
|
36 | - 'description' => esc_html__('Order by name', 'event_espresso'), |
|
37 | - ], |
|
38 | - 'START_DATE' => [ |
|
39 | - 'value' => 'TKT_start_date', |
|
40 | - 'description' => esc_html__('Order by start date', 'event_espresso'), |
|
41 | - ], |
|
42 | - ]; |
|
43 | - } |
|
28 | + /** |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + protected function getValues(): array |
|
32 | + { |
|
33 | + return [ |
|
34 | + 'NAME' => [ |
|
35 | + 'value' => 'TKT_name', |
|
36 | + 'description' => esc_html__('Order by name', 'event_espresso'), |
|
37 | + ], |
|
38 | + 'START_DATE' => [ |
|
39 | + 'value' => 'TKT_start_date', |
|
40 | + 'description' => esc_html__('Order by start date', 'event_espresso'), |
|
41 | + ], |
|
42 | + ]; |
|
43 | + } |
|
44 | 44 | } |
@@ -21,7 +21,7 @@ |
||
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 | } |
@@ -15,35 +15,35 @@ |
||
15 | 15 | */ |
16 | 16 | class PriceBaseTypeEnum extends EnumBase |
17 | 17 | { |
18 | - /** |
|
19 | - * PriceBaseTypeEnum constructor. |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - $this->setName($this->namespace . 'PriceBaseTypeEnum'); |
|
24 | - $this->setDescription(esc_html__('Price Base type ID', 'event_espresso')); |
|
25 | - parent::__construct(); |
|
26 | - } |
|
18 | + /** |
|
19 | + * PriceBaseTypeEnum constructor. |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + $this->setName($this->namespace . 'PriceBaseTypeEnum'); |
|
24 | + $this->setDescription(esc_html__('Price Base type ID', 'event_espresso')); |
|
25 | + parent::__construct(); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - protected function getValues(): array |
|
33 | - { |
|
34 | - return [ |
|
35 | - 'BASE_PRICE' => [ |
|
36 | - 'value' => EEM_Price_Type::base_type_base_price, |
|
37 | - ], |
|
38 | - 'DISCOUNT' => [ |
|
39 | - 'value' => EEM_Price_Type::base_type_discount, |
|
40 | - ], |
|
41 | - 'SURCHARGE' => [ |
|
42 | - 'value' => EEM_Price_Type::base_type_surcharge, |
|
43 | - ], |
|
44 | - 'TAX' => [ |
|
45 | - 'value' => EEM_Price_Type::base_type_tax, |
|
46 | - ], |
|
47 | - ]; |
|
48 | - } |
|
29 | + /** |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + protected function getValues(): array |
|
33 | + { |
|
34 | + return [ |
|
35 | + 'BASE_PRICE' => [ |
|
36 | + 'value' => EEM_Price_Type::base_type_base_price, |
|
37 | + ], |
|
38 | + 'DISCOUNT' => [ |
|
39 | + 'value' => EEM_Price_Type::base_type_discount, |
|
40 | + ], |
|
41 | + 'SURCHARGE' => [ |
|
42 | + 'value' => EEM_Price_Type::base_type_surcharge, |
|
43 | + ], |
|
44 | + 'TAX' => [ |
|
45 | + 'value' => EEM_Price_Type::base_type_tax, |
|
46 | + ], |
|
47 | + ]; |
|
48 | + } |
|
49 | 49 | } |
@@ -24,7 +24,7 @@ discard block |
||
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 |
||
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', |
@@ -16,31 +16,31 @@ |
||
16 | 16 | */ |
17 | 17 | class DatetimesConnectionOrderbyInput extends InputBase |
18 | 18 | { |
19 | - /** |
|
20 | - * DatetimesConnectionOrderbyInput constructor. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $this->setName($this->namespace . 'DatetimesConnectionOrderbyInput'); |
|
25 | - $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
19 | + /** |
|
20 | + * DatetimesConnectionOrderbyInput constructor. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $this->setName($this->namespace . 'DatetimesConnectionOrderbyInput'); |
|
25 | + $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return GraphQLFieldInterface[] |
|
32 | - */ |
|
33 | - protected function getFields(): array |
|
34 | - { |
|
35 | - return [ |
|
36 | - new GraphQLField( |
|
37 | - 'field', |
|
38 | - ['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum'] |
|
39 | - ), |
|
40 | - new GraphQLField( |
|
41 | - 'order', |
|
42 | - 'OrderEnum' |
|
43 | - ), |
|
44 | - ]; |
|
45 | - } |
|
30 | + /** |
|
31 | + * @return GraphQLFieldInterface[] |
|
32 | + */ |
|
33 | + protected function getFields(): array |
|
34 | + { |
|
35 | + return [ |
|
36 | + new GraphQLField( |
|
37 | + 'field', |
|
38 | + ['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum'] |
|
39 | + ), |
|
40 | + new GraphQLField( |
|
41 | + 'order', |
|
42 | + 'OrderEnum' |
|
43 | + ), |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | } |
@@ -24,7 +24,7 @@ discard block |
||
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 |
||
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', |
@@ -16,31 +16,31 @@ |
||
16 | 16 | */ |
17 | 17 | class TicketsConnectionOrderbyInput extends InputBase |
18 | 18 | { |
19 | - /** |
|
20 | - * TicketsConnectionOrderbyInput constructor. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $this->setName($this->namespace . 'TicketsConnectionOrderbyInput'); |
|
25 | - $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
19 | + /** |
|
20 | + * TicketsConnectionOrderbyInput constructor. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $this->setName($this->namespace . 'TicketsConnectionOrderbyInput'); |
|
25 | + $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return GraphQLFieldInterface[] |
|
32 | - */ |
|
33 | - protected function getFields(): array |
|
34 | - { |
|
35 | - return [ |
|
36 | - new GraphQLField( |
|
37 | - 'field', |
|
38 | - ['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum'] |
|
39 | - ), |
|
40 | - new GraphQLField( |
|
41 | - 'order', |
|
42 | - 'OrderEnum' |
|
43 | - ), |
|
44 | - ]; |
|
45 | - } |
|
30 | + /** |
|
31 | + * @return GraphQLFieldInterface[] |
|
32 | + */ |
|
33 | + protected function getFields(): array |
|
34 | + { |
|
35 | + return [ |
|
36 | + new GraphQLField( |
|
37 | + 'field', |
|
38 | + ['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum'] |
|
39 | + ), |
|
40 | + new GraphQLField( |
|
41 | + 'order', |
|
42 | + 'OrderEnum' |
|
43 | + ), |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | } |
@@ -38,8 +38,8 @@ |
||
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'], |
@@ -18,43 +18,43 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryPricesConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * PriceConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Price $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Price $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * PriceConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Price $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Price $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'Price', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'Prices', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection", |
|
42 | - 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'Price', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'Prices', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection", |
|
42 | + 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return PriceConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new PriceConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return PriceConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new PriceConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | } |
@@ -38,8 +38,8 @@ |
||
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'], |
@@ -18,43 +18,43 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryDatetimesConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * DatetimeConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Datetime $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Datetime $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * DatetimeConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Datetime $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Datetime $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'Datetime', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace . 'Datetimes'), |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryDatetimesConnection", |
|
42 | - 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'Datetime', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace . 'Datetimes'), |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryDatetimesConnection", |
|
42 | + 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return DatetimeConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return DatetimeConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | } |
@@ -38,8 +38,8 @@ |
||
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'], |
@@ -18,43 +18,43 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryTicketsConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * TicketConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Ticket $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Ticket $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * TicketConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Ticket $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Ticket $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'Ticket', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
42 | - 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'Ticket', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
42 | + 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return TicketConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new TicketConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return TicketConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new TicketConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | } |
@@ -32,158 +32,158 @@ |
||
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 |
@@ -58,7 +58,7 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | $deletion_job_code = isset($request_data['deletion_job_code']) ? sanitize_key($request_data['deletion_job_code']) : ''; |
90 | 90 | $models_and_ids_to_delete = $this->dao->getModelsAndIdsFromGroup($deletion_job_code); |
91 | 91 | $event_ids = isset($models_and_ids_to_delete['Event']) ? $models_and_ids_to_delete['Event'] : array(); |
92 | - if (empty($event_ids) || !is_array($event_ids)) { |
|
92 | + if (empty($event_ids) || ! is_array($event_ids)) { |
|
93 | 93 | throw new EE_Error( |
94 | 94 | esc_html__('No Events were found to delete.', 'event_espresso') |
95 | 95 | ); |
96 | 96 | } |
97 | 97 | $datetime_ids = isset($models_and_ids_to_delete['Datetime']) ? $models_and_ids_to_delete['Datetime'] : array(); |
98 | - if (!is_array($datetime_ids)) { |
|
98 | + if ( ! is_array($datetime_ids)) { |
|
99 | 99 | throw new UnexpectedEntityException($datetime_ids, 'array'); |
100 | 100 | } |
101 | 101 | $registration_ids = isset($models_and_ids_to_delete['Registration']) ? $models_and_ids_to_delete['Registration'] : array(); |
102 | - if (!is_array($registration_ids)) { |
|
102 | + if ( ! is_array($registration_ids)) { |
|
103 | 103 | throw new UnexpectedEntityException($registration_ids, 'array'); |
104 | 104 | } |
105 | 105 | $num_registrations_to_show = 10; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ]; |
136 | 136 | return [ |
137 | 137 | 'admin_page_content' => EEH_Template::display_template( |
138 | - EVENTS_TEMPLATE_PATH . 'event_preview_deletion.template.php', |
|
138 | + EVENTS_TEMPLATE_PATH.'event_preview_deletion.template.php', |
|
139 | 139 | [ |
140 | 140 | 'form_url' => EE_Admin_Page::add_query_args_and_nonce( |
141 | 141 | $confirm_deletion_args, |
@@ -31,127 +31,127 @@ |
||
31 | 31 | */ |
32 | 32 | class PreviewDeletion |
33 | 33 | { |
34 | - /** |
|
35 | - * @var NodeGroupDao |
|
36 | - */ |
|
37 | - protected $dao; |
|
34 | + /** |
|
35 | + * @var NodeGroupDao |
|
36 | + */ |
|
37 | + protected $dao; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var EEM_Event |
|
41 | - */ |
|
42 | - protected $event_model; |
|
39 | + /** |
|
40 | + * @var EEM_Event |
|
41 | + */ |
|
42 | + protected $event_model; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @var EEM_Datetime |
|
46 | - */ |
|
47 | - protected $datetime_model; |
|
44 | + /** |
|
45 | + * @var EEM_Datetime |
|
46 | + */ |
|
47 | + protected $datetime_model; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @var EEM_Registration |
|
51 | - */ |
|
52 | - protected $registration_model; |
|
49 | + /** |
|
50 | + * @var EEM_Registration |
|
51 | + */ |
|
52 | + protected $registration_model; |
|
53 | 53 | |
54 | - /** |
|
55 | - * PreviewDeletion constructor. |
|
56 | - * @param NodeGroupDao $dao |
|
57 | - * @param EEM_Event $event_model |
|
58 | - * @param EEM_Datetime $datetime_model |
|
59 | - * @param EEM_Registration $registration_model |
|
60 | - */ |
|
61 | - public function __construct( |
|
62 | - NodeGroupDao $dao, |
|
63 | - EEM_Event $event_model, |
|
64 | - EEM_Datetime $datetime_model, |
|
65 | - EEM_Registration $registration_model |
|
66 | - ) { |
|
67 | - $this->dao = $dao; |
|
68 | - $this->event_model = $event_model; |
|
69 | - $this->datetime_model = $datetime_model; |
|
70 | - $this->registration_model = $registration_model; |
|
71 | - } |
|
54 | + /** |
|
55 | + * PreviewDeletion constructor. |
|
56 | + * @param NodeGroupDao $dao |
|
57 | + * @param EEM_Event $event_model |
|
58 | + * @param EEM_Datetime $datetime_model |
|
59 | + * @param EEM_Registration $registration_model |
|
60 | + */ |
|
61 | + public function __construct( |
|
62 | + NodeGroupDao $dao, |
|
63 | + EEM_Event $event_model, |
|
64 | + EEM_Datetime $datetime_model, |
|
65 | + EEM_Registration $registration_model |
|
66 | + ) { |
|
67 | + $this->dao = $dao; |
|
68 | + $this->event_model = $event_model; |
|
69 | + $this->datetime_model = $datetime_model; |
|
70 | + $this->registration_model = $registration_model; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Renders the preview deletion page. |
|
75 | - * @since 4.10.12.p |
|
76 | - * @param $request_data |
|
77 | - * @param $admin_base_url |
|
78 | - * @return array |
|
79 | - * @throws UnexpectedEntityException |
|
80 | - * @throws DomainException |
|
81 | - * @throws EE_Error |
|
82 | - * @throws InvalidDataTypeException |
|
83 | - * @throws InvalidInterfaceException |
|
84 | - * @throws InvalidArgumentException |
|
85 | - * @throws ReflectionException |
|
86 | - */ |
|
87 | - public function handle($request_data, $admin_base_url) |
|
88 | - { |
|
89 | - $deletion_job_code = isset($request_data['deletion_job_code']) ? sanitize_key($request_data['deletion_job_code']) : ''; |
|
90 | - $models_and_ids_to_delete = $this->dao->getModelsAndIdsFromGroup($deletion_job_code); |
|
91 | - $event_ids = isset($models_and_ids_to_delete['Event']) ? $models_and_ids_to_delete['Event'] : array(); |
|
92 | - if (empty($event_ids) || !is_array($event_ids)) { |
|
93 | - throw new EE_Error( |
|
94 | - esc_html__('No Events were found to delete.', 'event_espresso') |
|
95 | - ); |
|
96 | - } |
|
97 | - $datetime_ids = isset($models_and_ids_to_delete['Datetime']) ? $models_and_ids_to_delete['Datetime'] : array(); |
|
98 | - if (!is_array($datetime_ids)) { |
|
99 | - throw new UnexpectedEntityException($datetime_ids, 'array'); |
|
100 | - } |
|
101 | - $registration_ids = isset($models_and_ids_to_delete['Registration']) ? $models_and_ids_to_delete['Registration'] : array(); |
|
102 | - if (!is_array($registration_ids)) { |
|
103 | - throw new UnexpectedEntityException($registration_ids, 'array'); |
|
104 | - } |
|
105 | - $num_registrations_to_show = 10; |
|
106 | - $reg_count = count($registration_ids); |
|
107 | - if ($reg_count > $num_registrations_to_show) { |
|
108 | - $registration_ids = array_slice($registration_ids, 0, $num_registrations_to_show); |
|
109 | - } |
|
110 | - $form = new ConfirmEventDeletionForm($event_ids); |
|
111 | - $events = $this->event_model->get_all_deleted_and_undeleted( |
|
112 | - [ |
|
113 | - [ |
|
114 | - 'EVT_ID' => ['IN', $event_ids] |
|
115 | - ] |
|
116 | - ] |
|
117 | - ); |
|
118 | - $datetimes = $this->datetime_model->get_all_deleted_and_undeleted( |
|
119 | - [ |
|
120 | - [ |
|
121 | - 'DTT_ID' => ['IN', $datetime_ids] |
|
122 | - ] |
|
123 | - ] |
|
124 | - ); |
|
125 | - $registrations = $this->registration_model->get_all_deleted_and_undeleted( |
|
126 | - [ |
|
127 | - [ |
|
128 | - 'REG_ID' => ['IN', $registration_ids] |
|
129 | - ] |
|
130 | - ] |
|
131 | - ); |
|
132 | - $confirm_deletion_args = [ |
|
133 | - 'action' => 'confirm_deletion', |
|
134 | - 'deletion_job_code' => $deletion_job_code |
|
135 | - ]; |
|
136 | - return [ |
|
137 | - 'admin_page_content' => EEH_Template::display_template( |
|
138 | - EVENTS_TEMPLATE_PATH . 'event_preview_deletion.template.php', |
|
139 | - [ |
|
140 | - 'form_url' => EE_Admin_Page::add_query_args_and_nonce( |
|
141 | - $confirm_deletion_args, |
|
142 | - $admin_base_url |
|
143 | - ), |
|
144 | - 'form' => $form, |
|
145 | - 'events' => $events, |
|
146 | - 'datetimes' => $datetimes, |
|
147 | - 'registrations' => $registrations, |
|
148 | - 'reg_count' => $reg_count, |
|
149 | - 'num_registrations_to_show' => $num_registrations_to_show |
|
150 | - ], |
|
151 | - true |
|
152 | - ) |
|
153 | - ]; |
|
154 | - } |
|
73 | + /** |
|
74 | + * Renders the preview deletion page. |
|
75 | + * @since 4.10.12.p |
|
76 | + * @param $request_data |
|
77 | + * @param $admin_base_url |
|
78 | + * @return array |
|
79 | + * @throws UnexpectedEntityException |
|
80 | + * @throws DomainException |
|
81 | + * @throws EE_Error |
|
82 | + * @throws InvalidDataTypeException |
|
83 | + * @throws InvalidInterfaceException |
|
84 | + * @throws InvalidArgumentException |
|
85 | + * @throws ReflectionException |
|
86 | + */ |
|
87 | + public function handle($request_data, $admin_base_url) |
|
88 | + { |
|
89 | + $deletion_job_code = isset($request_data['deletion_job_code']) ? sanitize_key($request_data['deletion_job_code']) : ''; |
|
90 | + $models_and_ids_to_delete = $this->dao->getModelsAndIdsFromGroup($deletion_job_code); |
|
91 | + $event_ids = isset($models_and_ids_to_delete['Event']) ? $models_and_ids_to_delete['Event'] : array(); |
|
92 | + if (empty($event_ids) || !is_array($event_ids)) { |
|
93 | + throw new EE_Error( |
|
94 | + esc_html__('No Events were found to delete.', 'event_espresso') |
|
95 | + ); |
|
96 | + } |
|
97 | + $datetime_ids = isset($models_and_ids_to_delete['Datetime']) ? $models_and_ids_to_delete['Datetime'] : array(); |
|
98 | + if (!is_array($datetime_ids)) { |
|
99 | + throw new UnexpectedEntityException($datetime_ids, 'array'); |
|
100 | + } |
|
101 | + $registration_ids = isset($models_and_ids_to_delete['Registration']) ? $models_and_ids_to_delete['Registration'] : array(); |
|
102 | + if (!is_array($registration_ids)) { |
|
103 | + throw new UnexpectedEntityException($registration_ids, 'array'); |
|
104 | + } |
|
105 | + $num_registrations_to_show = 10; |
|
106 | + $reg_count = count($registration_ids); |
|
107 | + if ($reg_count > $num_registrations_to_show) { |
|
108 | + $registration_ids = array_slice($registration_ids, 0, $num_registrations_to_show); |
|
109 | + } |
|
110 | + $form = new ConfirmEventDeletionForm($event_ids); |
|
111 | + $events = $this->event_model->get_all_deleted_and_undeleted( |
|
112 | + [ |
|
113 | + [ |
|
114 | + 'EVT_ID' => ['IN', $event_ids] |
|
115 | + ] |
|
116 | + ] |
|
117 | + ); |
|
118 | + $datetimes = $this->datetime_model->get_all_deleted_and_undeleted( |
|
119 | + [ |
|
120 | + [ |
|
121 | + 'DTT_ID' => ['IN', $datetime_ids] |
|
122 | + ] |
|
123 | + ] |
|
124 | + ); |
|
125 | + $registrations = $this->registration_model->get_all_deleted_and_undeleted( |
|
126 | + [ |
|
127 | + [ |
|
128 | + 'REG_ID' => ['IN', $registration_ids] |
|
129 | + ] |
|
130 | + ] |
|
131 | + ); |
|
132 | + $confirm_deletion_args = [ |
|
133 | + 'action' => 'confirm_deletion', |
|
134 | + 'deletion_job_code' => $deletion_job_code |
|
135 | + ]; |
|
136 | + return [ |
|
137 | + 'admin_page_content' => EEH_Template::display_template( |
|
138 | + EVENTS_TEMPLATE_PATH . 'event_preview_deletion.template.php', |
|
139 | + [ |
|
140 | + 'form_url' => EE_Admin_Page::add_query_args_and_nonce( |
|
141 | + $confirm_deletion_args, |
|
142 | + $admin_base_url |
|
143 | + ), |
|
144 | + 'form' => $form, |
|
145 | + 'events' => $events, |
|
146 | + 'datetimes' => $datetimes, |
|
147 | + 'registrations' => $registrations, |
|
148 | + 'reg_count' => $reg_count, |
|
149 | + 'num_registrations_to_show' => $num_registrations_to_show |
|
150 | + ], |
|
151 | + true |
|
152 | + ) |
|
153 | + ]; |
|
154 | + } |
|
155 | 155 | } |
156 | 156 | // End of file PreviewDeletion.php |
157 | 157 | // Location: EventEspresso\core\domain\services\admin\events\data/PreviewDeletion.php |