Completed
Branch BUG/required-message-fields (8f9492)
by
unknown
10:53 queued 20s
created
admin_pages/payments/help_tabs/payment_methods_overview.help_tab.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
                 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.',
54 54
                 'event_espresso'
55 55
             ),
56
-            '<img src="' . admin_url('images/media-button-image.gif') . '">'
56
+            '<img src="'.admin_url('images/media-button-image.gif').'">'
57 57
         );
58 58
         ?>
59 59
     </li>
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -12,62 +12,62 @@  discard block
 block discarded – undo
12 12
         <strong><?php esc_html_e('Name', 'event_espresso'); ?></strong>
13 13
         <br>
14 14
         <?php esc_html_e(
15
-            'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.',
16
-            'event_espresso'
17
-        ); ?>
15
+			'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.',
16
+			'event_espresso'
17
+		); ?>
18 18
     </li>
19 19
     <li>
20 20
         <strong><?php esc_html_e('Description', 'event_espresso'); ?></strong>
21 21
         <br />
22 22
         <?php esc_html_e(
23
-            'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.',
24
-            'event_espresso'
25
-        ); ?>
23
+			'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.',
24
+			'event_espresso'
25
+		); ?>
26 26
     </li>
27 27
     <li>
28 28
         <strong><?php esc_html_e('Admin-Only Name', 'event_espresso'); ?></strong>
29 29
         <br />
30 30
         <?php esc_html_e(
31
-            'The name of the payment method as seen internally by site administrators and staff.',
32
-            'event_espresso'
33
-        ); ?>
31
+			'The name of the payment method as seen internally by site administrators and staff.',
32
+			'event_espresso'
33
+		); ?>
34 34
     </li>
35 35
     <li>
36 36
         <strong><?php esc_html_e('Admin-Only Description', 'event_espresso'); ?></strong>
37 37
         <br />
38 38
         <?php esc_html_e(
39
-            'The description of the payment method as seen internally by site administrators and staff.',
40
-            'event_espresso'
41
-        ); ?>
39
+			'The description of the payment method as seen internally by site administrators and staff.',
40
+			'event_espresso'
41
+		); ?>
42 42
     </li>
43 43
     <li>
44 44
         <strong><?php esc_html_e('Debug (sandbox) Mode', 'event_espresso'); ?></strong>
45 45
         <br />
46 46
         <?php esc_html_e(
47
-            'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.',
48
-            'event_espresso'
49
-        ); ?>
47
+			'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.',
48
+			'event_espresso'
49
+		); ?>
50 50
     </li>
51 51
     <li>
52 52
         <strong><?php esc_html_e('Open by Default', 'event_espresso'); ?></strong>
53 53
         <br />
54 54
         <?php esc_html_e(
55
-            'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)',
56
-            'event_espresso'
57
-        ); ?>
55
+			'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)',
56
+			'event_espresso'
57
+		); ?>
58 58
     </li>
59 59
     <li>
60 60
         <strong><?php esc_html_e('Button URL', 'event_espresso'); ?></strong>
61 61
         <br />
62 62
         <?php
63
-        printf(
64
-            esc_html__(
65
-                'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.',
66
-                'event_espresso'
67
-            ),
68
-            '<img src="' . admin_url('images/media-button-image.gif') . '">'
69
-        );
70
-        ?>
63
+		printf(
64
+			esc_html__(
65
+				'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.',
66
+				'event_espresso'
67
+			),
68
+			'<img src="' . admin_url('images/media-button-image.gif') . '">'
69
+		);
70
+		?>
71 71
     </li>
72 72
     <li>
73 73
         <strong><?php esc_html_e('Usable From', 'event_espresso'); ?></strong>
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
         <ul>
77 77
             <li>
78 78
                 <?php esc_html_e(
79
-                    'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.',
80
-                    'event_espresso'
81
-                ); ?>
79
+					'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.',
80
+					'event_espresso'
81
+				); ?>
82 82
             </li>
83 83
             <li>
84 84
                 <?php esc_html_e(
85
-                    'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.',
86
-                    'event_espresso'
87
-                ); ?>
85
+					'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.',
86
+					'event_espresso'
87
+				); ?>
88 88
             </li>
89 89
         </ul>
90 90
     </li>
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
 <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong>
93 93
 <br />
94 94
 <?php esc_html_e(
95
-    'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.',
96
-    'event_espresso'
95
+	'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.',
96
+	'event_espresso'
97 97
 ); ?>
98 98
 <p>
99 99
     <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong>
100 100
     <br />
101 101
     <?php esc_html_e(
102
-        'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.',
103
-        'event_espresso'
104
-    ); ?>
102
+		'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.',
103
+		'event_espresso'
104
+	); ?>
105 105
 </p>
Please login to merge, or discard this patch.
core/domain/entities/admin/GraphQLData/Event.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 class Event extends GraphQLData
6 6
 {
7 7
 
8
-    /**
9
-     * @inheritDoc
10
-     */
11
-    public function getData(array $params = [])
12
-    {
13
-        $field_key = lcfirst($this->namespace) . 'Event';
14
-        $query     = <<<QUERY
8
+	/**
9
+	 * @inheritDoc
10
+	 */
11
+	public function getData(array $params = [])
12
+	{
13
+		$field_key = lcfirst($this->namespace) . 'Event';
14
+		$query     = <<<QUERY
15 15
         query GET_EVENT(\$id: ID!) {
16 16
             {$field_key}(id: \$id, idType: DATABASE_ID) {
17 17
                 id
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
             }
49 49
         }
50 50
 QUERY;
51
-        $this->setParams(
52
-            [
53
-                'operation_name' => 'GET_EVENT',
54
-                'variables'      => $params,
55
-                'query'          => $query,
56
-            ]
57
-        );
51
+		$this->setParams(
52
+			[
53
+				'operation_name' => 'GET_EVENT',
54
+				'variables'      => $params,
55
+				'query'          => $query,
56
+			]
57
+		);
58 58
 
59
-        return $this->getQueryResponse($field_key);
60
-    }
59
+		return $this->getQueryResponse($field_key);
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
      */
11 11
     public function getData(array $params = [])
12 12
     {
13
-        $field_key = lcfirst($this->namespace) . 'Event';
13
+        $field_key = lcfirst($this->namespace).'Event';
14 14
         $query     = <<<QUERY
15 15
         query GET_EVENT(\$id: ID!) {
16 16
             {$field_key}(id: \$id, idType: DATABASE_ID) {
Please login to merge, or discard this patch.
core/domain/entities/routing/data_nodes/core/SitePermissions.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@
 block discarded – undo
8 8
 
9 9
 class SitePermissions extends JsonDataNode
10 10
 {
11
-    const NODE_NAME = 'sitePermissions';
12
-
13
-    /**
14
-     * @var FeatureFlags
15
-     */
16
-    private $feature_flags;
17
-
18
-
19
-    /**
20
-     * @param FeatureFlags          $feature_flags
21
-     * @param JsonDataNodeValidator $validator
22
-     */
23
-    public function __construct(FeatureFlags $feature_flags, JsonDataNodeValidator $validator)
24
-    {
25
-        $this->feature_flags = $feature_flags;
26
-        parent::__construct($validator);
27
-        $this->setNodeName(SitePermissions::NODE_NAME);
28
-    }
29
-
30
-
31
-    /**
32
-     * @inheritDoc
33
-     */
34
-    public function initialize()
35
-    {
36
-        $this->setDataArray($this->feature_flags->getAllowedFeatures());
37
-    }
11
+	const NODE_NAME = 'sitePermissions';
12
+
13
+	/**
14
+	 * @var FeatureFlags
15
+	 */
16
+	private $feature_flags;
17
+
18
+
19
+	/**
20
+	 * @param FeatureFlags          $feature_flags
21
+	 * @param JsonDataNodeValidator $validator
22
+	 */
23
+	public function __construct(FeatureFlags $feature_flags, JsonDataNodeValidator $validator)
24
+	{
25
+		$this->feature_flags = $feature_flags;
26
+		parent::__construct($validator);
27
+		$this->setNodeName(SitePermissions::NODE_NAME);
28
+	}
29
+
30
+
31
+	/**
32
+	 * @inheritDoc
33
+	 */
34
+	public function initialize()
35
+	{
36
+		$this->setDataArray($this->feature_flags->getAllowedFeatures());
37
+	}
38 38
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/data_nodes/core/Api.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -18,38 +18,38 @@
 block discarded – undo
18 18
  */
19 19
 class Api extends JsonDataNode
20 20
 {
21
-    const NODE_NAME = 'api';
22
-
23
-
24
-    /**
25
-     * @param JsonDataNodeValidator $validator
26
-     */
27
-    public function __construct(JsonDataNodeValidator $validator)
28
-    {
29
-        parent::__construct($validator);
30
-        $this->setNodeName(Api::NODE_NAME);
31
-    }
32
-
33
-
34
-    /**
35
-     * @throws DomainException
36
-     * @since $VID:$
37
-     */
38
-    public function initialize()
39
-    {
40
-        $this->addData('restApiNonce', wp_create_nonce('wp_rest'));
41
-        $this->addData('restApiBaseUrl', rest_url());
42
-        $this->addData('restApiRouteUrl', rest_url('ee/v4.8.36/'));
43
-        $this->addData('restApiCollectionEndpoints', EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName());
44
-        $this->addData('restApiPrimaryKeys', EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName());
45
-
46
-        // route can be something like 'graphql'
47
-        $route = trim(Router::$route, '/');
48
-        // make sure we are dealing with sane folks
49
-        $has_pretty_permalinks = (bool) get_option('permalink_structure');
50
-        // if pretty permalinks, use '/graphql' otherwise '?graphql=1'
51
-        $graphqlEndpoint = $has_pretty_permalinks ? site_url($route) : add_query_arg($route, 1, site_url());
52
-        $this->addData('graphqlEndpoint', esc_url($graphqlEndpoint));
53
-        $this->setInitialized(true);
54
-    }
21
+	const NODE_NAME = 'api';
22
+
23
+
24
+	/**
25
+	 * @param JsonDataNodeValidator $validator
26
+	 */
27
+	public function __construct(JsonDataNodeValidator $validator)
28
+	{
29
+		parent::__construct($validator);
30
+		$this->setNodeName(Api::NODE_NAME);
31
+	}
32
+
33
+
34
+	/**
35
+	 * @throws DomainException
36
+	 * @since $VID:$
37
+	 */
38
+	public function initialize()
39
+	{
40
+		$this->addData('restApiNonce', wp_create_nonce('wp_rest'));
41
+		$this->addData('restApiBaseUrl', rest_url());
42
+		$this->addData('restApiRouteUrl', rest_url('ee/v4.8.36/'));
43
+		$this->addData('restApiCollectionEndpoints', EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName());
44
+		$this->addData('restApiPrimaryKeys', EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName());
45
+
46
+		// route can be something like 'graphql'
47
+		$route = trim(Router::$route, '/');
48
+		// make sure we are dealing with sane folks
49
+		$has_pretty_permalinks = (bool) get_option('permalink_structure');
50
+		// if pretty permalinks, use '/graphql' otherwise '?graphql=1'
51
+		$graphqlEndpoint = $has_pretty_permalinks ? site_url($route) : add_query_arg($route, 1, site_url());
52
+		$this->addData('graphqlEndpoint', esc_url($graphqlEndpoint));
53
+		$this->setInitialized(true);
54
+	}
55 55
 }
Please login to merge, or discard this patch.
core/services/graphql/GraphQLEndpoint.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@
 block discarded – undo
52 52
      */
53 53
     public function isGraphqlRequest()
54 54
     {
55
-        if (! isset($this->is_gql_request)) {
55
+        if ( ! isset($this->is_gql_request)) {
56 56
             // grab the GQL endpoint that we saved in the future... wait... wut?
57 57
             $endpoint = $this->getEndpoint();
58
-            if (! class_exists('WPGraphQL')) {
59
-                require_once EE_THIRD_PARTY . 'wp-graphql/src/Router.php';
58
+            if ( ! class_exists('WPGraphQL')) {
59
+                require_once EE_THIRD_PARTY.'wp-graphql/src/Router.php';
60 60
             }
61 61
             // set our saved endpoint on the WP GQL Pouter class
62 62
             // don't worry, this is a static property that they overwrite when they initialize things,
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -18,85 +18,85 @@
 block discarded – undo
18 18
  */
19 19
 class GraphQLEndpoint extends WordPressOption
20 20
 {
21
-    const DEFAULT_ENDPOINT = 'graphql';
21
+	const DEFAULT_ENDPOINT = 'graphql';
22 22
 
23
-    const OPTION_NAME      = 'ee-graphql-endpoint';
23
+	const OPTION_NAME      = 'ee-graphql-endpoint';
24 24
 
25
-    /**
26
-     * @var boolean
27
-     */
28
-    private $is_gql_request;
25
+	/**
26
+	 * @var boolean
27
+	 */
28
+	private $is_gql_request;
29 29
 
30 30
 
31
-    /**
32
-     * GraphQLEndpoint constructor.
33
-     */
34
-    public function __construct()
35
-    {
36
-        parent::__construct(GraphQLEndpoint::OPTION_NAME, GraphQLEndpoint::DEFAULT_ENDPOINT, true);
37
-        add_action('graphql_register_settings', [$this, 'verifyAndSetEndpoint'], 20);
38
-        // disable WPGraphQL admin by default.
39
-        add_filter('graphql_show_admin', '__return_false', 10);
40
-        add_filter('graphql_enable_graphiql', '__return_false', 10);
41
-    }
31
+	/**
32
+	 * GraphQLEndpoint constructor.
33
+	 */
34
+	public function __construct()
35
+	{
36
+		parent::__construct(GraphQLEndpoint::OPTION_NAME, GraphQLEndpoint::DEFAULT_ENDPOINT, true);
37
+		add_action('graphql_register_settings', [$this, 'verifyAndSetEndpoint'], 20);
38
+		// disable WPGraphQL admin by default.
39
+		add_filter('graphql_show_admin', '__return_false', 10);
40
+		add_filter('graphql_enable_graphiql', '__return_false', 10);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @return false|mixed|void
46
-     */
47
-    public function getEndpoint()
48
-    {
49
-        return $this->loadOption();
50
-    }
44
+	/**
45
+	 * @return false|mixed|void
46
+	 */
47
+	public function getEndpoint()
48
+	{
49
+		return $this->loadOption();
50
+	}
51 51
 
52 52
 
53
-    /**
54
-     * @return mixed|void|bool
55
-     */
56
-    public function isGraphqlRequest()
57
-    {
58
-        if (! isset($this->is_gql_request)) {
59
-            // grab the GQL endpoint that we saved in the future... wait... wut?
60
-            $endpoint = $this->getEndpoint();
61
-            if (! class_exists('WPGraphQL')) {
62
-                require_once EE_THIRD_PARTY . 'wp-graphql/src/Router.php';
63
-            }
64
-            // set our saved endpoint on the WP GQL Pouter class
65
-            // don't worry, this is a static property that they overwrite when they initialize things,
66
-            // and we are essentially getting the value from them anyways, so it should be ok (fingers crossed)
67
-            Router::$route = $endpoint;
68
-            // now call their function for checking if this is a GQL request
69
-            // because they use a bunch of filters and stuff we don't want to duplicate here
70
-            $this->is_gql_request = Router::is_graphql_http_request();
71
-        }
72
-        return $this->is_gql_request;
73
-    }
53
+	/**
54
+	 * @return mixed|void|bool
55
+	 */
56
+	public function isGraphqlRequest()
57
+	{
58
+		if (! isset($this->is_gql_request)) {
59
+			// grab the GQL endpoint that we saved in the future... wait... wut?
60
+			$endpoint = $this->getEndpoint();
61
+			if (! class_exists('WPGraphQL')) {
62
+				require_once EE_THIRD_PARTY . 'wp-graphql/src/Router.php';
63
+			}
64
+			// set our saved endpoint on the WP GQL Pouter class
65
+			// don't worry, this is a static property that they overwrite when they initialize things,
66
+			// and we are essentially getting the value from them anyways, so it should be ok (fingers crossed)
67
+			Router::$route = $endpoint;
68
+			// now call their function for checking if this is a GQL request
69
+			// because they use a bunch of filters and stuff we don't want to duplicate here
70
+			$this->is_gql_request = Router::is_graphql_http_request();
71
+		}
72
+		return $this->is_gql_request;
73
+	}
74 74
 
75 75
 
76
-    /**
77
-     * callback hooked into the graphql_register_settings action
78
-     * basically grabs the value for the 'graphql_endpoint' setting and saves it to our own WP option.
79
-     *
80
-     * i know, i know, i know...
81
-     * WHY are we saving the graphql_endpoint to a WP option if WP GraphQL is already doing the same ?!?!
82
-     *
83
-     * Because we perform our request type detection during `plugins_loaded`,
84
-     * but they don't settle on their endpoint until `after_setup_theme` has run,
85
-     * which is too late for us, so we are just going to save this separately so that we have it.
86
-     * Oh, and this will essentially recheck this value on EVERY request
87
-     * but will only update our saved value if it has actually changed
88
-     */
89
-    public function verifyAndSetEndpoint()
90
-    {
91
-        try {
92
-            $this->updateOption(
93
-                get_graphql_setting(
94
-                    'graphql_endpoint',
95
-                    apply_filters('graphql_endpoint', GraphQLEndpoint::DEFAULT_ENDPOINT)
96
-                )
97
-            );
98
-        } catch (Throwable $t) {
99
-            // eat it
100
-        }
101
-    }
76
+	/**
77
+	 * callback hooked into the graphql_register_settings action
78
+	 * basically grabs the value for the 'graphql_endpoint' setting and saves it to our own WP option.
79
+	 *
80
+	 * i know, i know, i know...
81
+	 * WHY are we saving the graphql_endpoint to a WP option if WP GraphQL is already doing the same ?!?!
82
+	 *
83
+	 * Because we perform our request type detection during `plugins_loaded`,
84
+	 * but they don't settle on their endpoint until `after_setup_theme` has run,
85
+	 * which is too late for us, so we are just going to save this separately so that we have it.
86
+	 * Oh, and this will essentially recheck this value on EVERY request
87
+	 * but will only update our saved value if it has actually changed
88
+	 */
89
+	public function verifyAndSetEndpoint()
90
+	{
91
+		try {
92
+			$this->updateOption(
93
+				get_graphql_setting(
94
+					'graphql_endpoint',
95
+					apply_filters('graphql_endpoint', GraphQLEndpoint::DEFAULT_ENDPOINT)
96
+				)
97
+			);
98
+		} catch (Throwable $t) {
99
+			// eat it
100
+		}
101
+	}
102 102
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 ),
122 122
             ],
123 123
         ];
124
-        $this->_model_relations        = [
124
+        $this->_model_relations = [
125 125
             'Ticket'          => new EE_HABTM_Relation('Datetime_Ticket'),
126 126
             'Event'           => new EE_Belongs_To_Relation(),
127 127
             'Checkin'         => new EE_Has_Many_Relation(),
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
         $this->model_chain_to_password = $path_to_event_model;
132 132
         $this->_model_chain_to_wp_user = $path_to_event_model;
133 133
         // this model is generally available for reading
134
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ]       =
134
+        $this->_cap_restriction_generators[EEM_Base::caps_read] =
135 135
             new EE_Restriction_Generator_Event_Related_Public(
136 136
                 $path_to_event_model
137 137
             );
138
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] =
138
+        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] =
139 139
             new EE_Restriction_Generator_Event_Related_Protected(
140 140
                 $path_to_event_model
141 141
             );
142
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ]       =
142
+        $this->_cap_restriction_generators[EEM_Base::caps_edit] =
143 143
             new EE_Restriction_Generator_Event_Related_Protected(
144 144
                 $path_to_event_model
145 145
             );
146
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ]     =
146
+        $this->_cap_restriction_generators[EEM_Base::caps_delete] =
147 147
             new EE_Restriction_Generator_Event_Related_Protected(
148 148
                 $path_to_event_model,
149 149
                 EEM_Base::caps_edit
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
          * @param int $end_data Unix timestamp representing now + 30 days in seconds.
186 186
          * @return int Unix timestamp
187 187
          */
188
-        $end_date       = apply_filters(
188
+        $end_date = apply_filters(
189 189
             'FHEE__EEM_Datetime__create_new_blank_datetime__end_date',
190 190
             $this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS
191 191
         );
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
      */
252 252
     private function validateStartAndEndTimeForBlankDate(array $start_time, array $end_time)
253 253
     {
254
-        if (! is_array($start_time)) {
254
+        if ( ! is_array($start_time)) {
255 255
             throw new InvalidDataTypeException('start_time', $start_time, 'array');
256 256
         }
257
-        if (! is_array($end_time)) {
257
+        if ( ! is_array($end_time)) {
258 258
             throw new InvalidDataTypeException('end_time', $end_time, 'array');
259 259
         }
260 260
         if (count($start_time) !== 2) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     public function get_all_event_dates($EVT_ID = 0)
291 291
     {
292
-        if (! $EVT_ID) { // on add_new_event event_id gets set to 0
292
+        if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
293 293
             return $this->create_new_blank_datetime();
294 294
         }
295 295
         $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             $query_params,
427 427
             EEM_Base::default_where_conditions_this_only
428 428
         );
429
-        $query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
429
+        $query_params = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
430 430
         return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
431 431
     }
432 432
 
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
         $query_params['group_by'] = ['dtt_year', 'dtt_month'];
588 588
         $query_params             = $this->addOrderByQueryParams($query_params, 'DTT_EVT_start', 'DESC');
589 589
 
590
-        $query_interval    = EEH_DTT_Helper::get_sql_query_interval_for_offset(
590
+        $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset(
591 591
             $this->get_timezone(),
592 592
             'DTT_EVT_start'
593 593
         );
594 594
         $columns_to_select = [
595
-            'dtt_year'      => ['YEAR(' . $query_interval . ')', '%s'],
596
-            'dtt_month'     => ['MONTHNAME(' . $query_interval . ')', '%s'],
597
-            'dtt_month_num' => ['MONTH(' . $query_interval . ')', '%s'],
595
+            'dtt_year'      => ['YEAR('.$query_interval.')', '%s'],
596
+            'dtt_month'     => ['MONTHNAME('.$query_interval.')', '%s'],
597
+            'dtt_month_num' => ['MONTH('.$query_interval.')', '%s'],
598 598
         ];
599 599
         return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
600 600
     }
@@ -676,17 +676,17 @@  discard block
 block discarded – undo
676 676
                 ['DTT_EVT_end' => ['<', time()]]
677 677
             ),
678 678
         ];
679
-        if (! empty($stati_to_include)) {
679
+        if ( ! empty($stati_to_include)) {
680 680
             foreach (array_keys($status_query_args) as $status) {
681
-                if (! in_array($status, $stati_to_include, true)) {
682
-                    unset($status_query_args[ $status ]);
681
+                if ( ! in_array($status, $stati_to_include, true)) {
682
+                    unset($status_query_args[$status]);
683 683
                 }
684 684
             }
685 685
         }
686 686
         // loop through and query counts for each stati.
687 687
         $status_query_results = [];
688 688
         foreach ($status_query_args as $status => $status_where_conditions) {
689
-            $status_query_results[ $status ] = EEM_Datetime::count(
689
+            $status_query_results[$status] = EEM_Datetime::count(
690 690
                 [$status_where_conditions],
691 691
                 'DTT_ID',
692 692
                 true
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
     public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = [])
708 708
     {
709 709
         $count = $this->get_datetime_counts_by_status([$status], $query_params);
710
-        return ! empty($count[ $status ]) ? $count[ $status ] : 0;
710
+        return ! empty($count[$status]) ? $count[$status] : 0;
711 711
     }
712 712
 
713 713
 
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
      */
807 807
     private function addExpiredWhereParams(array $where_params, bool $include_expired = true)
808 808
     {
809
-        if (! $include_expired) {
809
+        if ( ! $include_expired) {
810 810
             $where_params['DTT_EVT_end'] = ['>=', current_time('mysql', true)];
811 811
         }
812 812
         return $where_params;
Please login to merge, or discard this patch.
Indentation   +838 added lines, -838 removed lines patch added patch discarded remove patch
@@ -12,842 +12,842 @@
 block discarded – undo
12 12
  */
13 13
 class EEM_Datetime extends EEM_Soft_Delete_Base
14 14
 {
15
-    /**
16
-     * @var EEM_Datetime $_instance
17
-     */
18
-    protected static $_instance;
19
-
20
-
21
-    /**
22
-     * private constructor to prevent direct creation
23
-     *
24
-     * @param string $timezone A string representing the timezone we want to set for returned Date Time Strings
25
-     *                         (and any incoming timezone data that gets saved).
26
-     *                         Note this just sends the timezone info to the date time model field objects.
27
-     *                         Default is NULL
28
-     *                         (and will be assumed using the set timezone in the 'timezone_string' wp option)
29
-     * @throws EE_Error
30
-     * @throws InvalidArgumentException
31
-     * @throws InvalidArgumentException
32
-     */
33
-    protected function __construct($timezone)
34
-    {
35
-        $this->singular_item           = esc_html__('Datetime', 'event_espresso');
36
-        $this->plural_item             = esc_html__('Datetimes', 'event_espresso');
37
-        $this->_tables                 = [
38
-            'Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID'),
39
-        ];
40
-        $this->_fields                 = [
41
-            'Datetime' => [
42
-                'DTT_ID'          => new EE_Primary_Key_Int_Field(
43
-                    'DTT_ID',
44
-                    esc_html__('Datetime ID', 'event_espresso')
45
-                ),
46
-                'EVT_ID'          => new EE_Foreign_Key_Int_Field(
47
-                    'EVT_ID',
48
-                    esc_html__('Event ID', 'event_espresso'),
49
-                    false,
50
-                    0,
51
-                    'Event'
52
-                ),
53
-                'VNU_ID' => new EE_Foreign_Key_Int_Field(
54
-                    'VNU_ID',
55
-                    __('Venue ID', 'event_espresso'),
56
-                    false,
57
-                    0,
58
-                    'Venue'
59
-                ),
60
-                'DTT_name'        => new EE_Plain_Text_Field(
61
-                    'DTT_name',
62
-                    esc_html__('Datetime Name', 'event_espresso'),
63
-                    false,
64
-                    ''
65
-                ),
66
-                'DTT_description' => new EE_Post_Content_Field(
67
-                    'DTT_description',
68
-                    esc_html__('Description for Datetime', 'event_espresso'),
69
-                    false,
70
-                    ''
71
-                ),
72
-                'DTT_EVT_start'   => new EE_Datetime_Field(
73
-                    'DTT_EVT_start',
74
-                    esc_html__('Start time/date of Event', 'event_espresso'),
75
-                    false,
76
-                    EE_Datetime_Field::now,
77
-                    $timezone
78
-                ),
79
-                'DTT_EVT_end'     => new EE_Datetime_Field(
80
-                    'DTT_EVT_end',
81
-                    esc_html__('End time/date of Event', 'event_espresso'),
82
-                    false,
83
-                    EE_Datetime_Field::now,
84
-                    $timezone
85
-                ),
86
-                'DTT_reg_limit'   => new EE_Infinite_Integer_Field(
87
-                    'DTT_reg_limit',
88
-                    esc_html__('Registration Limit for this time', 'event_espresso'),
89
-                    true,
90
-                    EE_INF
91
-                ),
92
-                'DTT_sold'        => new EE_Integer_Field(
93
-                    'DTT_sold',
94
-                    esc_html__('How many sales for this Datetime that have occurred', 'event_espresso'),
95
-                    true,
96
-                    0
97
-                ),
98
-                'DTT_reserved'    => new EE_Integer_Field(
99
-                    'DTT_reserved',
100
-                    esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'),
101
-                    false,
102
-                    0
103
-                ),
104
-                'DTT_is_primary'  => new EE_Boolean_Field(
105
-                    'DTT_is_primary',
106
-                    esc_html__('Flag indicating datetime is primary one for event', 'event_espresso'),
107
-                    false,
108
-                    false
109
-                ),
110
-                'DTT_order'       => new EE_Integer_Field(
111
-                    'DTT_order',
112
-                    esc_html__('The order in which the Datetime is displayed', 'event_espresso'),
113
-                    false,
114
-                    0
115
-                ),
116
-                'DTT_parent'      => new EE_Integer_Field(
117
-                    'DTT_parent',
118
-                    esc_html__('Indicates what DTT_ID is the parent of this DTT_ID', 'event_espresso'),
119
-                    true,
120
-                    0
121
-                ),
122
-                'DTT_deleted'     => new EE_Trashed_Flag_Field(
123
-                    'DTT_deleted',
124
-                    esc_html__('Flag indicating datetime is archived', 'event_espresso'),
125
-                    false,
126
-                    false
127
-                ),
128
-            ],
129
-        ];
130
-        $this->_model_relations        = [
131
-            'Ticket'          => new EE_HABTM_Relation('Datetime_Ticket'),
132
-            'Event'           => new EE_Belongs_To_Relation(),
133
-            'Checkin'         => new EE_Has_Many_Relation(),
134
-            'Datetime_Ticket' => new EE_Has_Many_Relation(),
135
-            'Venue'           => new EE_Belongs_To_Relation(),
136
-        ];
137
-        $path_to_event_model           = 'Event';
138
-        $this->model_chain_to_password = $path_to_event_model;
139
-        $this->_model_chain_to_wp_user = $path_to_event_model;
140
-        // this model is generally available for reading
141
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ]       =
142
-            new EE_Restriction_Generator_Event_Related_Public(
143
-                $path_to_event_model
144
-            );
145
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] =
146
-            new EE_Restriction_Generator_Event_Related_Protected(
147
-                $path_to_event_model
148
-            );
149
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ]       =
150
-            new EE_Restriction_Generator_Event_Related_Protected(
151
-                $path_to_event_model
152
-            );
153
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ]     =
154
-            new EE_Restriction_Generator_Event_Related_Protected(
155
-                $path_to_event_model,
156
-                EEM_Base::caps_edit
157
-            );
158
-        parent::__construct($timezone);
159
-    }
160
-
161
-
162
-    /**
163
-     * create new blank datetime
164
-     *
165
-     * @access public
166
-     * @return EE_Datetime[] array on success, FALSE on fail
167
-     * @throws EE_Error
168
-     * @throws InvalidArgumentException
169
-     * @throws InvalidDataTypeException
170
-     * @throws ReflectionException
171
-     * @throws InvalidInterfaceException
172
-     */
173
-    public function create_new_blank_datetime()
174
-    {
175
-        // makes sure timezone is always set.
176
-        $timezone_string = $this->get_timezone();
177
-        /**
178
-         * Filters the initial start date for the new datetime.
179
-         * Any time included in this value will be overridden later so use additional filters to modify the time.
180
-         *
181
-         * @param int $start_date Unix timestamp representing now + 30 days in seconds.
182
-         * @return int Unix timestamp
183
-         */
184
-        $start_date = apply_filters(
185
-            'FHEE__EEM_Datetime__create_new_blank_datetime__start_date',
186
-            $this->current_time_for_query('DTT_EVT_start', true) + MONTH_IN_SECONDS
187
-        );
188
-        /**
189
-         * Filters the initial end date for the new datetime.
190
-         * Any time included in this value will be overridden later so use additional filters to modify the time.
191
-         *
192
-         * @param int $end_data Unix timestamp representing now + 30 days in seconds.
193
-         * @return int Unix timestamp
194
-         */
195
-        $end_date       = apply_filters(
196
-            'FHEE__EEM_Datetime__create_new_blank_datetime__end_date',
197
-            $this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS
198
-        );
199
-        $blank_datetime = EE_Datetime::new_instance(
200
-            [
201
-                'DTT_EVT_start' => $start_date,
202
-                'DTT_EVT_end'   => $end_date,
203
-                'DTT_order'     => 1,
204
-                'DTT_reg_limit' => EE_INF,
205
-            ],
206
-            $timezone_string
207
-        );
208
-        /**
209
-         * Filters the initial start time and format for the new EE_Datetime instance.
210
-         *
211
-         * @param array $start_time An array having size 2.  First element is the time, second element is the time
212
-         *                          format.
213
-         * @return array
214
-         */
215
-        $start_time = apply_filters(
216
-            'FHEE__EEM_Datetime__create_new_blank_datetime__start_time',
217
-            ['8am', 'ga']
218
-        );
219
-        /**
220
-         * Filters the initial end time and format for the new EE_Datetime instance.
221
-         *
222
-         * @param array $end_time An array having size 2.  First element is the time, second element is the time
223
-         *                        format
224
-         * @return array
225
-         */
226
-        $end_time = apply_filters(
227
-            'FHEE__EEM_Datetime__create_new_blank_datetime__end_time',
228
-            ['5pm', 'ga']
229
-        );
230
-        $this->validateStartAndEndTimeForBlankDate($start_time, $end_time);
231
-        $blank_datetime->set_start_time(
232
-            $this->convert_datetime_for_query(
233
-                'DTT_EVT_start',
234
-                $start_time[0],
235
-                $start_time[1],
236
-                $timezone_string
237
-            )
238
-        );
239
-        $blank_datetime->set_end_time(
240
-            $this->convert_datetime_for_query(
241
-                'DTT_EVT_end',
242
-                $end_time[0],
243
-                $end_time[1],
244
-                $timezone_string
245
-            )
246
-        );
247
-        return [$blank_datetime];
248
-    }
249
-
250
-
251
-    /**
252
-     * Validates whether the start_time and end_time are in the expected format.
253
-     *
254
-     * @param array $start_time
255
-     * @param array $end_time
256
-     * @throws InvalidArgumentException
257
-     * @throws InvalidDataTypeException
258
-     */
259
-    private function validateStartAndEndTimeForBlankDate(array $start_time, array $end_time)
260
-    {
261
-        if (! is_array($start_time)) {
262
-            throw new InvalidDataTypeException('start_time', $start_time, 'array');
263
-        }
264
-        if (! is_array($end_time)) {
265
-            throw new InvalidDataTypeException('end_time', $end_time, 'array');
266
-        }
267
-        if (count($start_time) !== 2) {
268
-            throw new InvalidArgumentException(
269
-                sprintf(
270
-                    'The variable %1$s is expected to be an array with two elements.  The first item in the '
271
-                    . 'array should be a valid time string, the second item in the array should be a valid time format',
272
-                    '$start_time'
273
-                )
274
-            );
275
-        }
276
-        if (count($end_time) !== 2) {
277
-            throw new InvalidArgumentException(
278
-                sprintf(
279
-                    'The variable %1$s is expected to be an array with two elements.  The first item in the '
280
-                    . 'array should be a valid time string, the second item in the array should be a valid time format',
281
-                    '$end_time'
282
-                )
283
-            );
284
-        }
285
-    }
286
-
287
-
288
-    /**
289
-     * get event start date from db
290
-     *
291
-     * @access public
292
-     * @param int $EVT_ID
293
-     * @return EE_Datetime[] array on success, FALSE on fail
294
-     * @throws EE_Error
295
-     * @throws ReflectionException
296
-     */
297
-    public function get_all_event_dates($EVT_ID = 0)
298
-    {
299
-        if (! $EVT_ID) { // on add_new_event event_id gets set to 0
300
-            return $this->create_new_blank_datetime();
301
-        }
302
-        $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
303
-        if (empty($results)) {
304
-            return $this->create_new_blank_datetime();
305
-        }
306
-        return $results;
307
-    }
308
-
309
-
310
-    /**
311
-     * get all datetimes attached to an event ordered by the DTT_order field
312
-     *
313
-     * @public
314
-     * @param int     $EVT_ID     event id
315
-     * @param boolean $include_expired
316
-     * @param boolean $include_deleted
317
-     * @param int     $limit      If included then limit the count of results by
318
-     *                            the given number
319
-     * @return EE_Datetime[]
320
-     * @throws EE_Error
321
-     */
322
-    public function get_datetimes_for_event_ordered_by_DTT_order(
323
-        int $EVT_ID,
324
-        bool $include_expired = true,
325
-        bool $include_deleted = true,
326
-        $limit = 0
327
-    ) {
328
-        $prev_data_prep_value = $this->prepModelForQuery();
329
-        $where_params         = ['Event.EVT_ID' => absint($EVT_ID)];
330
-        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
331
-        $query_params         = $this->addDefaultWhereConditions($query_params);
332
-        $query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
333
-        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
334
-    }
335
-
336
-
337
-    /**
338
-     * Gets the datetimes for the event (with the given limit), and orders them by "importance".
339
-     * By importance, we mean that the primary datetimes are most important (DEPRECATED FOR NOW),
340
-     * and then the earlier datetimes are the most important.
341
-     * Maybe we'll want this to take into account datetimes that haven't already passed, but we don't yet.
342
-     *
343
-     * @param int $EVT_ID
344
-     * @param int $limit
345
-     * @return EE_Datetime[]|EE_Base_Class[]
346
-     * @throws EE_Error
347
-     */
348
-    public function get_datetimes_for_event_ordered_by_importance(int $EVT_ID, $limit = 0)
349
-    {
350
-        $query_params[0] = ['Event.EVT_ID' => absint($EVT_ID)];
351
-        $query_params    = $this->addDefaultWhereConditions($query_params);
352
-        $query_params    = $this->addDefaultQueryParams($query_params, $limit);
353
-        return $this->get_all($query_params);
354
-    }
355
-
356
-
357
-    /**
358
-     * @param int     $EVT_ID
359
-     * @param boolean $include_expired
360
-     * @param boolean $include_deleted
361
-     * @return EE_Datetime
362
-     * @throws EE_Error
363
-     */
364
-    public function get_oldest_datetime_for_event(
365
-        int $EVT_ID,
366
-        bool $include_expired = false,
367
-        bool $include_deleted = false
368
-    ) {
369
-        $results = $this->get_datetimes_for_event_ordered_by_start_time(
370
-            $EVT_ID,
371
-            $include_expired,
372
-            $include_deleted,
373
-            1
374
-        );
375
-        if ($results) {
376
-            return array_shift($results);
377
-        }
378
-        return null;
379
-    }
380
-
381
-
382
-    /**
383
-     * Gets the 'primary' datetime for an event.
384
-     *
385
-     * @param int  $EVT_ID
386
-     * @param bool $try_to_exclude_expired
387
-     * @param bool $try_to_exclude_deleted
388
-     * @return EE_Datetime
389
-     * @throws EE_Error
390
-     */
391
-    public function get_primary_datetime_for_event(
392
-        int $EVT_ID,
393
-        bool $try_to_exclude_expired = true,
394
-        bool $try_to_exclude_deleted = true
395
-    ) {
396
-        if ($try_to_exclude_expired) {
397
-            $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
398
-            if ($non_expired) {
399
-                return $non_expired;
400
-            }
401
-        }
402
-        if ($try_to_exclude_deleted) {
403
-            $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
404
-            if ($expired_even) {
405
-                return $expired_even;
406
-            }
407
-        }
408
-        return $this->get_oldest_datetime_for_event($EVT_ID, true, true);
409
-    }
410
-
411
-
412
-    /**
413
-     * Gets ALL the datetimes for an event (including trashed ones, for now), ordered
414
-     * only by start date
415
-     *
416
-     * @param int     $EVT_ID
417
-     * @param boolean $include_expired
418
-     * @param boolean $include_deleted
419
-     * @param int     $limit
420
-     * @return EE_Datetime[]
421
-     * @throws EE_Error
422
-     */
423
-    public function get_datetimes_for_event_ordered_by_start_time(
424
-        int $EVT_ID,
425
-        bool $include_expired = true,
426
-        bool $include_deleted = true,
427
-        $limit = 0
428
-    ) {
429
-        $prev_data_prep_value = $this->prepModelForQuery();
430
-        $where_params         = ['Event.EVT_ID' => absint($EVT_ID)];
431
-        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
432
-        $query_params         = $this->addDefaultWhereConditions(
433
-            $query_params,
434
-            EEM_Base::default_where_conditions_this_only
435
-        );
436
-        $query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
437
-        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
438
-    }
439
-
440
-
441
-    /**
442
-     * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
443
-     * only by start date
444
-     *
445
-     * @param int     $TKT_ID
446
-     * @param boolean $include_expired
447
-     * @param boolean $include_deleted
448
-     * @param int     $limit
449
-     * @return EE_Datetime[]
450
-     * @throws EE_Error
451
-     */
452
-    public function get_datetimes_for_ticket_ordered_by_start_time(
453
-        int $TKT_ID,
454
-        bool $include_expired = true,
455
-        bool $include_deleted = true,
456
-        $limit = 0
457
-    ) {
458
-        $prev_data_prep_value = $this->prepModelForQuery();
459
-        $where_params         = ['Ticket.TKT_ID' => absint($TKT_ID)];
460
-        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
461
-        $query_params         = $this->addDefaultQueryParams($query_params, $limit);
462
-        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
463
-    }
464
-
465
-
466
-    /**
467
-     * Gets all the datetimes for a ticket (including trashed ones, for now), ordered by the DTT_order for the
468
-     * datetimes.
469
-     *
470
-     * @param int      $TKT_ID           ID of ticket to retrieve the datetimes for
471
-     * @param boolean  $include_expired  whether to include expired datetimes or not
472
-     * @param boolean  $include_deleted  whether to include trashed datetimes or not.
473
-     * @param int|null $limit            if null, no limit, if int then limit results by
474
-     *                                   that number
475
-     * @return EE_Datetime[]
476
-     * @throws EE_Error
477
-     */
478
-    public function get_datetimes_for_ticket_ordered_by_DTT_order(
479
-        int $TKT_ID,
480
-        bool $include_expired = true,
481
-        bool $include_deleted = true,
482
-        $limit = 0
483
-    ) {
484
-        $prev_data_prep_value = $this->prepModelForQuery();
485
-        $where_params         = ['Ticket.TKT_ID' => absint($TKT_ID)];
486
-        $query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
487
-        $query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
488
-        return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
489
-    }
490
-
491
-
492
-    /**
493
-     * Gets the most important datetime for a particular event (ie, the primary event usually. But if for some WACK
494
-     * reason it doesn't exist, we consider the earliest event the most important)
495
-     *
496
-     * @param int $EVT_ID
497
-     * @return EE_Datetime
498
-     * @throws EE_Error
499
-     */
500
-    public function get_most_important_datetime_for_event(int $EVT_ID)
501
-    {
502
-        $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
503
-        if ($results) {
504
-            return array_shift($results);
505
-        }
506
-        return null;
507
-    }
508
-
509
-
510
-    /**
511
-     * This returns a wpdb->results        Array of all DTT month and years matching the incoming query params and
512
-     * grouped by month and year.
513
-     *
514
-     * @param array  $where_params       @see
515
-     *                                   https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md#0-where-conditions
516
-     * @param string $evt_active_status  A string representing the evt active status to filter the months by.
517
-     *                                   Can be:
518
-     *                                   - '' = no filter
519
-     *                                   - upcoming = Published events with at least one upcoming datetime.
520
-     *                                   - expired = Events with all datetimes expired.
521
-     *                                   - active = Events that are published and have at least one datetime that
522
-     *                                   starts before now and ends after now.
523
-     *                                   - inactive = Events that are either not published.
524
-     * @return stdClass[]
525
-     * @throws EE_Error
526
-     * @throws InvalidArgumentException
527
-     * @throws InvalidArgumentException
528
-     */
529
-    public function get_dtt_months_and_years(array $where_params, $evt_active_status = '')
530
-    {
531
-        $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
532
-        $current_time_for_DTT_EVT_end   = $this->current_time_for_query('DTT_EVT_end');
533
-        switch ($evt_active_status) {
534
-            case 'upcoming':
535
-                $where_params['Event.status'] = 'publish';
536
-                // if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
537
-                if (isset($where_params['DTT_EVT_start'])) {
538
-                    $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
539
-                }
540
-                $where_params['DTT_EVT_start'] = ['>', $current_time_for_DTT_EVT_start];
541
-                break;
542
-            case 'expired':
543
-                if (isset($where_params['Event.status'])) {
544
-                    unset($where_params['Event.status']);
545
-                }
546
-                // get events to exclude
547
-                $exclude_query[0] = array_merge(
548
-                    $where_params,
549
-                    ['DTT_EVT_end' => ['>', $current_time_for_DTT_EVT_end]]
550
-                );
551
-                // first get all events that have datetimes where its not expired.
552
-                $event_ids = $this->_get_all_wpdb_results(
553
-                    $exclude_query,
554
-                    OBJECT_K,
555
-                    'Datetime.EVT_ID'
556
-                );
557
-                $event_ids = array_keys($event_ids);
558
-                if (isset($where_params['DTT_EVT_end'])) {
559
-                    $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
560
-                }
561
-                $where_params['DTT_EVT_end']  = ['<', $current_time_for_DTT_EVT_end];
562
-                $where_params['Event.EVT_ID'] = ['NOT IN', $event_ids];
563
-                break;
564
-            case 'active':
565
-                $where_params['Event.status'] = 'publish';
566
-                if (isset($where_params['DTT_EVT_start'])) {
567
-                    $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
568
-                }
569
-                if (isset($where_params['Datetime.DTT_EVT_end'])) {
570
-                    $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
571
-                }
572
-                $where_params['DTT_EVT_start'] = ['<', $current_time_for_DTT_EVT_start];
573
-                $where_params['DTT_EVT_end']   = ['>', $current_time_for_DTT_EVT_end];
574
-                break;
575
-            case 'inactive':
576
-                if (isset($where_params['Event.status'])) {
577
-                    unset($where_params['Event.status']);
578
-                }
579
-                if (isset($where_params['OR'])) {
580
-                    $where_params['AND']['OR'] = $where_params['OR'];
581
-                }
582
-                if (isset($where_params['DTT_EVT_end'])) {
583
-                    $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
584
-                    unset($where_params['DTT_EVT_end']);
585
-                }
586
-                if (isset($where_params['DTT_EVT_start'])) {
587
-                    $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
588
-                    unset($where_params['DTT_EVT_start']);
589
-                }
590
-                $where_params['AND']['Event.status'] = ['!=', 'publish'];
591
-                break;
592
-        }
593
-        $query_params[0]          = $where_params;
594
-        $query_params['group_by'] = ['dtt_year', 'dtt_month'];
595
-        $query_params             = $this->addOrderByQueryParams($query_params, 'DTT_EVT_start', 'DESC');
596
-
597
-        $query_interval    = EEH_DTT_Helper::get_sql_query_interval_for_offset(
598
-            $this->get_timezone(),
599
-            'DTT_EVT_start'
600
-        );
601
-        $columns_to_select = [
602
-            'dtt_year'      => ['YEAR(' . $query_interval . ')', '%s'],
603
-            'dtt_month'     => ['MONTHNAME(' . $query_interval . ')', '%s'],
604
-            'dtt_month_num' => ['MONTH(' . $query_interval . ')', '%s'],
605
-        ];
606
-        return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
607
-    }
608
-
609
-
610
-    /**
611
-     * Updates the DTT_sold attribute on each datetime (based on the registrations
612
-     * for the tickets for each datetime)
613
-     *
614
-     * @param EE_Base_Class[]|EE_Datetime[] $datetimes
615
-     * @throws EE_Error
616
-     * @throws ReflectionException
617
-     */
618
-    public function update_sold(array $datetimes)
619
-    {
620
-        EE_Error::doing_it_wrong(
621
-            __FUNCTION__,
622
-            esc_html__(
623
-                'Please use \EEM_Ticket::update_tickets_sold() instead which will in turn correctly update both the Ticket AND Datetime counts.',
624
-                'event_espresso'
625
-            ),
626
-            '4.9.32.rc.005'
627
-        );
628
-        foreach ($datetimes as $datetime) {
629
-            $datetime->update_sold();
630
-        }
631
-    }
632
-
633
-
634
-    /**
635
-     *    Gets the total number of tickets available at a particular datetime
636
-     *    (does NOT take into account the datetime's spaces available)
637
-     *
638
-     * @param int   $DTT_ID
639
-     * @param array $query_params
640
-     * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO
641
-     *             tickets attached to datetime then FALSE is returned.
642
-     * @throws EE_Error
643
-     * @throws ReflectionException
644
-     */
645
-    public function sum_tickets_currently_available_at_datetime(int $DTT_ID, array $query_params = [])
646
-    {
647
-        $datetime = $this->get_one_by_ID($DTT_ID);
648
-        if ($datetime instanceof EE_Datetime) {
649
-            return $datetime->tickets_remaining($query_params);
650
-        }
651
-        return 0;
652
-    }
653
-
654
-
655
-    /**
656
-     * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
657
-     *
658
-     * @param array $stati_to_include  If included you can restrict the statuses we return counts for by including the
659
-     *                                 stati you want counts for as values in the array.  An empty array returns counts
660
-     *                                 for all valid stati.
661
-     * @param array $query_params      If included can be used to refine the conditions for returning the count (i.e.
662
-     *                                 only for Datetimes connected to a specific event, or specific ticket.
663
-     * @return array  The value returned is an array indexed by Datetime Status and the values are the counts.  The
664
-     * @throws EE_Error
665
-     *                                 stati used as index keys are: EE_Datetime::active EE_Datetime::upcoming
666
-     *                                 EE_Datetime::expired
667
-     */
668
-    public function get_datetime_counts_by_status(array $stati_to_include = [], array $query_params = [])
669
-    {
670
-        // only accept where conditions for this query.
671
-        $_where            = isset($query_params[0]) ? $query_params[0] : [];
672
-        $status_query_args = [
673
-            EE_Datetime::active   => array_merge(
674
-                $_where,
675
-                ['DTT_EVT_start' => ['<', time()], 'DTT_EVT_end' => ['>', time()]]
676
-            ),
677
-            EE_Datetime::upcoming => array_merge(
678
-                $_where,
679
-                ['DTT_EVT_start' => ['>', time()]]
680
-            ),
681
-            EE_Datetime::expired  => array_merge(
682
-                $_where,
683
-                ['DTT_EVT_end' => ['<', time()]]
684
-            ),
685
-        ];
686
-        if (! empty($stati_to_include)) {
687
-            foreach (array_keys($status_query_args) as $status) {
688
-                if (! in_array($status, $stati_to_include, true)) {
689
-                    unset($status_query_args[ $status ]);
690
-                }
691
-            }
692
-        }
693
-        // loop through and query counts for each stati.
694
-        $status_query_results = [];
695
-        foreach ($status_query_args as $status => $status_where_conditions) {
696
-            $status_query_results[ $status ] = EEM_Datetime::count(
697
-                [$status_where_conditions],
698
-                'DTT_ID',
699
-                true
700
-            );
701
-        }
702
-        return $status_query_results;
703
-    }
704
-
705
-
706
-    /**
707
-     * Returns the specific count for a given Datetime status matching any given query_params.
708
-     *
709
-     * @param string $status Valid string representation for Datetime status requested. (Defaults to Active).
710
-     * @param array  $query_params
711
-     * @return int
712
-     * @throws EE_Error
713
-     */
714
-    public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = [])
715
-    {
716
-        $count = $this->get_datetime_counts_by_status([$status], $query_params);
717
-        return ! empty($count[ $status ]) ? $count[ $status ] : 0;
718
-    }
719
-
720
-
721
-    /**
722
-     * @return bool|int
723
-     * @since   $VID:$
724
-     */
725
-    private function prepModelForQuery()
726
-    {
727
-        $prev_data_prep_value = $this->get_assumption_concerning_values_already_prepared_by_model_object();
728
-        $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
729
-        return $prev_data_prep_value;
730
-    }
731
-
732
-
733
-    /**
734
-     * @param array    $query_params
735
-     * @param bool|int $prev_data_prep_value
736
-     * @return EE_Base_Class[]|EE_Datetime[]
737
-     * @throws EE_Error
738
-     * @since   $VID:$
739
-     */
740
-    private function getDatetimesAndRestoreModel(array $query_params, $prev_data_prep_value)
741
-    {
742
-        $result = $this->get_all($query_params);
743
-        $this->assume_values_already_prepared_by_model_object($prev_data_prep_value);
744
-        return $result;
745
-    }
746
-
747
-
748
-    /**
749
-     * @param array  $query_params
750
-     * @param int    $limit
751
-     * @param string $order_by
752
-     * @param string $order
753
-     * @return array
754
-     * @since   $VID:$
755
-     */
756
-    private function addDefaultQueryParams(array $query_params, $limit = 0, $order_by = 'DTT_EVT_start', $order = 'ASC')
757
-    {
758
-        $query_params = $this->addOrderByQueryParams($query_params, $order_by, $order);
759
-        $query_params = $this->addLimitQueryParams($query_params, $limit);
760
-        return $query_params;
761
-    }
762
-
763
-
764
-    /**
765
-     * @param array  $query_params
766
-     * @param string $default_where_conditions
767
-     * @return array
768
-     * @since   $VID:$
769
-     */
770
-    private function addDefaultWhereConditions(
771
-        array $query_params,
772
-        $default_where_conditions = EEM_Base::default_where_conditions_none
773
-    ) {
774
-        $query_params['default_where_conditions'] = $default_where_conditions;
775
-        return $query_params;
776
-    }
777
-
778
-
779
-    /**
780
-     * @param array $where_params
781
-     * @param bool  $include_deleted
782
-     * @param bool  $include_expired
783
-     * @return array
784
-     * @since   $VID:$
785
-     */
786
-    private function addDefaultWhereParams(array $where_params, bool $include_deleted = true, bool $include_expired = true)
787
-    {
788
-        $where_params = $this->addExpiredWhereParams($where_params, $include_expired);
789
-        $where_params = $this->addDeletedWhereParams($where_params, $include_deleted);
790
-        return $where_params;
791
-    }
792
-
793
-
794
-    /**
795
-     * @param array $where_params
796
-     * @param bool  $include_deleted
797
-     * @return array
798
-     * @since   $VID:$
799
-     */
800
-    private function addDeletedWhereParams(array $where_params, bool $include_deleted = true)
801
-    {
802
-        $deleted                     = $include_deleted ? [true, false] : [false];
803
-        $where_params['DTT_deleted'] = ['IN', $deleted];
804
-        return $where_params;
805
-    }
806
-
807
-
808
-    /**
809
-     * @param array $where_params
810
-     * @param bool  $include_expired
811
-     * @return array
812
-     * @since   $VID:$
813
-     */
814
-    private function addExpiredWhereParams(array $where_params, bool $include_expired = true)
815
-    {
816
-        if (! $include_expired) {
817
-            $where_params['DTT_EVT_end'] = ['>=', current_time('mysql', true)];
818
-        }
819
-        return $where_params;
820
-    }
821
-
822
-
823
-    /**
824
-     * @param array $query_params
825
-     * @param int   $limit
826
-     * @return array
827
-     * @since   $VID:$
828
-     */
829
-    private function addLimitQueryParams(array $query_params, $limit = 0)
830
-    {
831
-        if ($limit) {
832
-            $query_params['limit'] = $limit;
833
-        }
834
-        return $query_params;
835
-    }
836
-
837
-
838
-    /**
839
-     * @param array  $query_params
840
-     * @param string $order_by
841
-     * @param string $order
842
-     * @return array
843
-     * @since   $VID:$
844
-     */
845
-    private function addOrderByQueryParams(array $query_params, $order_by = 'DTT_EVT_start', $order = 'ASC')
846
-    {
847
-        $order                    = $order === 'ASC' ? 'ASC' : 'DESC';
848
-        $valid_order_columns      = ['DTT_ID', 'DTT_EVT_start', 'DTT_EVT_end', 'DTT_order'];
849
-        $order_by                 = in_array($order_by, $valid_order_columns, true) ? $order_by : 'DTT_EVT_start';
850
-        $query_params['order_by'] = [$order_by => $order];
851
-        return $query_params;
852
-    }
15
+	/**
16
+	 * @var EEM_Datetime $_instance
17
+	 */
18
+	protected static $_instance;
19
+
20
+
21
+	/**
22
+	 * private constructor to prevent direct creation
23
+	 *
24
+	 * @param string $timezone A string representing the timezone we want to set for returned Date Time Strings
25
+	 *                         (and any incoming timezone data that gets saved).
26
+	 *                         Note this just sends the timezone info to the date time model field objects.
27
+	 *                         Default is NULL
28
+	 *                         (and will be assumed using the set timezone in the 'timezone_string' wp option)
29
+	 * @throws EE_Error
30
+	 * @throws InvalidArgumentException
31
+	 * @throws InvalidArgumentException
32
+	 */
33
+	protected function __construct($timezone)
34
+	{
35
+		$this->singular_item           = esc_html__('Datetime', 'event_espresso');
36
+		$this->plural_item             = esc_html__('Datetimes', 'event_espresso');
37
+		$this->_tables                 = [
38
+			'Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID'),
39
+		];
40
+		$this->_fields                 = [
41
+			'Datetime' => [
42
+				'DTT_ID'          => new EE_Primary_Key_Int_Field(
43
+					'DTT_ID',
44
+					esc_html__('Datetime ID', 'event_espresso')
45
+				),
46
+				'EVT_ID'          => new EE_Foreign_Key_Int_Field(
47
+					'EVT_ID',
48
+					esc_html__('Event ID', 'event_espresso'),
49
+					false,
50
+					0,
51
+					'Event'
52
+				),
53
+				'VNU_ID' => new EE_Foreign_Key_Int_Field(
54
+					'VNU_ID',
55
+					__('Venue ID', 'event_espresso'),
56
+					false,
57
+					0,
58
+					'Venue'
59
+				),
60
+				'DTT_name'        => new EE_Plain_Text_Field(
61
+					'DTT_name',
62
+					esc_html__('Datetime Name', 'event_espresso'),
63
+					false,
64
+					''
65
+				),
66
+				'DTT_description' => new EE_Post_Content_Field(
67
+					'DTT_description',
68
+					esc_html__('Description for Datetime', 'event_espresso'),
69
+					false,
70
+					''
71
+				),
72
+				'DTT_EVT_start'   => new EE_Datetime_Field(
73
+					'DTT_EVT_start',
74
+					esc_html__('Start time/date of Event', 'event_espresso'),
75
+					false,
76
+					EE_Datetime_Field::now,
77
+					$timezone
78
+				),
79
+				'DTT_EVT_end'     => new EE_Datetime_Field(
80
+					'DTT_EVT_end',
81
+					esc_html__('End time/date of Event', 'event_espresso'),
82
+					false,
83
+					EE_Datetime_Field::now,
84
+					$timezone
85
+				),
86
+				'DTT_reg_limit'   => new EE_Infinite_Integer_Field(
87
+					'DTT_reg_limit',
88
+					esc_html__('Registration Limit for this time', 'event_espresso'),
89
+					true,
90
+					EE_INF
91
+				),
92
+				'DTT_sold'        => new EE_Integer_Field(
93
+					'DTT_sold',
94
+					esc_html__('How many sales for this Datetime that have occurred', 'event_espresso'),
95
+					true,
96
+					0
97
+				),
98
+				'DTT_reserved'    => new EE_Integer_Field(
99
+					'DTT_reserved',
100
+					esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'),
101
+					false,
102
+					0
103
+				),
104
+				'DTT_is_primary'  => new EE_Boolean_Field(
105
+					'DTT_is_primary',
106
+					esc_html__('Flag indicating datetime is primary one for event', 'event_espresso'),
107
+					false,
108
+					false
109
+				),
110
+				'DTT_order'       => new EE_Integer_Field(
111
+					'DTT_order',
112
+					esc_html__('The order in which the Datetime is displayed', 'event_espresso'),
113
+					false,
114
+					0
115
+				),
116
+				'DTT_parent'      => new EE_Integer_Field(
117
+					'DTT_parent',
118
+					esc_html__('Indicates what DTT_ID is the parent of this DTT_ID', 'event_espresso'),
119
+					true,
120
+					0
121
+				),
122
+				'DTT_deleted'     => new EE_Trashed_Flag_Field(
123
+					'DTT_deleted',
124
+					esc_html__('Flag indicating datetime is archived', 'event_espresso'),
125
+					false,
126
+					false
127
+				),
128
+			],
129
+		];
130
+		$this->_model_relations        = [
131
+			'Ticket'          => new EE_HABTM_Relation('Datetime_Ticket'),
132
+			'Event'           => new EE_Belongs_To_Relation(),
133
+			'Checkin'         => new EE_Has_Many_Relation(),
134
+			'Datetime_Ticket' => new EE_Has_Many_Relation(),
135
+			'Venue'           => new EE_Belongs_To_Relation(),
136
+		];
137
+		$path_to_event_model           = 'Event';
138
+		$this->model_chain_to_password = $path_to_event_model;
139
+		$this->_model_chain_to_wp_user = $path_to_event_model;
140
+		// this model is generally available for reading
141
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ]       =
142
+			new EE_Restriction_Generator_Event_Related_Public(
143
+				$path_to_event_model
144
+			);
145
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] =
146
+			new EE_Restriction_Generator_Event_Related_Protected(
147
+				$path_to_event_model
148
+			);
149
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ]       =
150
+			new EE_Restriction_Generator_Event_Related_Protected(
151
+				$path_to_event_model
152
+			);
153
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ]     =
154
+			new EE_Restriction_Generator_Event_Related_Protected(
155
+				$path_to_event_model,
156
+				EEM_Base::caps_edit
157
+			);
158
+		parent::__construct($timezone);
159
+	}
160
+
161
+
162
+	/**
163
+	 * create new blank datetime
164
+	 *
165
+	 * @access public
166
+	 * @return EE_Datetime[] array on success, FALSE on fail
167
+	 * @throws EE_Error
168
+	 * @throws InvalidArgumentException
169
+	 * @throws InvalidDataTypeException
170
+	 * @throws ReflectionException
171
+	 * @throws InvalidInterfaceException
172
+	 */
173
+	public function create_new_blank_datetime()
174
+	{
175
+		// makes sure timezone is always set.
176
+		$timezone_string = $this->get_timezone();
177
+		/**
178
+		 * Filters the initial start date for the new datetime.
179
+		 * Any time included in this value will be overridden later so use additional filters to modify the time.
180
+		 *
181
+		 * @param int $start_date Unix timestamp representing now + 30 days in seconds.
182
+		 * @return int Unix timestamp
183
+		 */
184
+		$start_date = apply_filters(
185
+			'FHEE__EEM_Datetime__create_new_blank_datetime__start_date',
186
+			$this->current_time_for_query('DTT_EVT_start', true) + MONTH_IN_SECONDS
187
+		);
188
+		/**
189
+		 * Filters the initial end date for the new datetime.
190
+		 * Any time included in this value will be overridden later so use additional filters to modify the time.
191
+		 *
192
+		 * @param int $end_data Unix timestamp representing now + 30 days in seconds.
193
+		 * @return int Unix timestamp
194
+		 */
195
+		$end_date       = apply_filters(
196
+			'FHEE__EEM_Datetime__create_new_blank_datetime__end_date',
197
+			$this->current_time_for_query('DTT_EVT_end', true) + MONTH_IN_SECONDS
198
+		);
199
+		$blank_datetime = EE_Datetime::new_instance(
200
+			[
201
+				'DTT_EVT_start' => $start_date,
202
+				'DTT_EVT_end'   => $end_date,
203
+				'DTT_order'     => 1,
204
+				'DTT_reg_limit' => EE_INF,
205
+			],
206
+			$timezone_string
207
+		);
208
+		/**
209
+		 * Filters the initial start time and format for the new EE_Datetime instance.
210
+		 *
211
+		 * @param array $start_time An array having size 2.  First element is the time, second element is the time
212
+		 *                          format.
213
+		 * @return array
214
+		 */
215
+		$start_time = apply_filters(
216
+			'FHEE__EEM_Datetime__create_new_blank_datetime__start_time',
217
+			['8am', 'ga']
218
+		);
219
+		/**
220
+		 * Filters the initial end time and format for the new EE_Datetime instance.
221
+		 *
222
+		 * @param array $end_time An array having size 2.  First element is the time, second element is the time
223
+		 *                        format
224
+		 * @return array
225
+		 */
226
+		$end_time = apply_filters(
227
+			'FHEE__EEM_Datetime__create_new_blank_datetime__end_time',
228
+			['5pm', 'ga']
229
+		);
230
+		$this->validateStartAndEndTimeForBlankDate($start_time, $end_time);
231
+		$blank_datetime->set_start_time(
232
+			$this->convert_datetime_for_query(
233
+				'DTT_EVT_start',
234
+				$start_time[0],
235
+				$start_time[1],
236
+				$timezone_string
237
+			)
238
+		);
239
+		$blank_datetime->set_end_time(
240
+			$this->convert_datetime_for_query(
241
+				'DTT_EVT_end',
242
+				$end_time[0],
243
+				$end_time[1],
244
+				$timezone_string
245
+			)
246
+		);
247
+		return [$blank_datetime];
248
+	}
249
+
250
+
251
+	/**
252
+	 * Validates whether the start_time and end_time are in the expected format.
253
+	 *
254
+	 * @param array $start_time
255
+	 * @param array $end_time
256
+	 * @throws InvalidArgumentException
257
+	 * @throws InvalidDataTypeException
258
+	 */
259
+	private function validateStartAndEndTimeForBlankDate(array $start_time, array $end_time)
260
+	{
261
+		if (! is_array($start_time)) {
262
+			throw new InvalidDataTypeException('start_time', $start_time, 'array');
263
+		}
264
+		if (! is_array($end_time)) {
265
+			throw new InvalidDataTypeException('end_time', $end_time, 'array');
266
+		}
267
+		if (count($start_time) !== 2) {
268
+			throw new InvalidArgumentException(
269
+				sprintf(
270
+					'The variable %1$s is expected to be an array with two elements.  The first item in the '
271
+					. 'array should be a valid time string, the second item in the array should be a valid time format',
272
+					'$start_time'
273
+				)
274
+			);
275
+		}
276
+		if (count($end_time) !== 2) {
277
+			throw new InvalidArgumentException(
278
+				sprintf(
279
+					'The variable %1$s is expected to be an array with two elements.  The first item in the '
280
+					. 'array should be a valid time string, the second item in the array should be a valid time format',
281
+					'$end_time'
282
+				)
283
+			);
284
+		}
285
+	}
286
+
287
+
288
+	/**
289
+	 * get event start date from db
290
+	 *
291
+	 * @access public
292
+	 * @param int $EVT_ID
293
+	 * @return EE_Datetime[] array on success, FALSE on fail
294
+	 * @throws EE_Error
295
+	 * @throws ReflectionException
296
+	 */
297
+	public function get_all_event_dates($EVT_ID = 0)
298
+	{
299
+		if (! $EVT_ID) { // on add_new_event event_id gets set to 0
300
+			return $this->create_new_blank_datetime();
301
+		}
302
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
303
+		if (empty($results)) {
304
+			return $this->create_new_blank_datetime();
305
+		}
306
+		return $results;
307
+	}
308
+
309
+
310
+	/**
311
+	 * get all datetimes attached to an event ordered by the DTT_order field
312
+	 *
313
+	 * @public
314
+	 * @param int     $EVT_ID     event id
315
+	 * @param boolean $include_expired
316
+	 * @param boolean $include_deleted
317
+	 * @param int     $limit      If included then limit the count of results by
318
+	 *                            the given number
319
+	 * @return EE_Datetime[]
320
+	 * @throws EE_Error
321
+	 */
322
+	public function get_datetimes_for_event_ordered_by_DTT_order(
323
+		int $EVT_ID,
324
+		bool $include_expired = true,
325
+		bool $include_deleted = true,
326
+		$limit = 0
327
+	) {
328
+		$prev_data_prep_value = $this->prepModelForQuery();
329
+		$where_params         = ['Event.EVT_ID' => absint($EVT_ID)];
330
+		$query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
331
+		$query_params         = $this->addDefaultWhereConditions($query_params);
332
+		$query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
333
+		return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
334
+	}
335
+
336
+
337
+	/**
338
+	 * Gets the datetimes for the event (with the given limit), and orders them by "importance".
339
+	 * By importance, we mean that the primary datetimes are most important (DEPRECATED FOR NOW),
340
+	 * and then the earlier datetimes are the most important.
341
+	 * Maybe we'll want this to take into account datetimes that haven't already passed, but we don't yet.
342
+	 *
343
+	 * @param int $EVT_ID
344
+	 * @param int $limit
345
+	 * @return EE_Datetime[]|EE_Base_Class[]
346
+	 * @throws EE_Error
347
+	 */
348
+	public function get_datetimes_for_event_ordered_by_importance(int $EVT_ID, $limit = 0)
349
+	{
350
+		$query_params[0] = ['Event.EVT_ID' => absint($EVT_ID)];
351
+		$query_params    = $this->addDefaultWhereConditions($query_params);
352
+		$query_params    = $this->addDefaultQueryParams($query_params, $limit);
353
+		return $this->get_all($query_params);
354
+	}
355
+
356
+
357
+	/**
358
+	 * @param int     $EVT_ID
359
+	 * @param boolean $include_expired
360
+	 * @param boolean $include_deleted
361
+	 * @return EE_Datetime
362
+	 * @throws EE_Error
363
+	 */
364
+	public function get_oldest_datetime_for_event(
365
+		int $EVT_ID,
366
+		bool $include_expired = false,
367
+		bool $include_deleted = false
368
+	) {
369
+		$results = $this->get_datetimes_for_event_ordered_by_start_time(
370
+			$EVT_ID,
371
+			$include_expired,
372
+			$include_deleted,
373
+			1
374
+		);
375
+		if ($results) {
376
+			return array_shift($results);
377
+		}
378
+		return null;
379
+	}
380
+
381
+
382
+	/**
383
+	 * Gets the 'primary' datetime for an event.
384
+	 *
385
+	 * @param int  $EVT_ID
386
+	 * @param bool $try_to_exclude_expired
387
+	 * @param bool $try_to_exclude_deleted
388
+	 * @return EE_Datetime
389
+	 * @throws EE_Error
390
+	 */
391
+	public function get_primary_datetime_for_event(
392
+		int $EVT_ID,
393
+		bool $try_to_exclude_expired = true,
394
+		bool $try_to_exclude_deleted = true
395
+	) {
396
+		if ($try_to_exclude_expired) {
397
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
398
+			if ($non_expired) {
399
+				return $non_expired;
400
+			}
401
+		}
402
+		if ($try_to_exclude_deleted) {
403
+			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
404
+			if ($expired_even) {
405
+				return $expired_even;
406
+			}
407
+		}
408
+		return $this->get_oldest_datetime_for_event($EVT_ID, true, true);
409
+	}
410
+
411
+
412
+	/**
413
+	 * Gets ALL the datetimes for an event (including trashed ones, for now), ordered
414
+	 * only by start date
415
+	 *
416
+	 * @param int     $EVT_ID
417
+	 * @param boolean $include_expired
418
+	 * @param boolean $include_deleted
419
+	 * @param int     $limit
420
+	 * @return EE_Datetime[]
421
+	 * @throws EE_Error
422
+	 */
423
+	public function get_datetimes_for_event_ordered_by_start_time(
424
+		int $EVT_ID,
425
+		bool $include_expired = true,
426
+		bool $include_deleted = true,
427
+		$limit = 0
428
+	) {
429
+		$prev_data_prep_value = $this->prepModelForQuery();
430
+		$where_params         = ['Event.EVT_ID' => absint($EVT_ID)];
431
+		$query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
432
+		$query_params         = $this->addDefaultWhereConditions(
433
+			$query_params,
434
+			EEM_Base::default_where_conditions_this_only
435
+		);
436
+		$query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
437
+		return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
438
+	}
439
+
440
+
441
+	/**
442
+	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
443
+	 * only by start date
444
+	 *
445
+	 * @param int     $TKT_ID
446
+	 * @param boolean $include_expired
447
+	 * @param boolean $include_deleted
448
+	 * @param int     $limit
449
+	 * @return EE_Datetime[]
450
+	 * @throws EE_Error
451
+	 */
452
+	public function get_datetimes_for_ticket_ordered_by_start_time(
453
+		int $TKT_ID,
454
+		bool $include_expired = true,
455
+		bool $include_deleted = true,
456
+		$limit = 0
457
+	) {
458
+		$prev_data_prep_value = $this->prepModelForQuery();
459
+		$where_params         = ['Ticket.TKT_ID' => absint($TKT_ID)];
460
+		$query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
461
+		$query_params         = $this->addDefaultQueryParams($query_params, $limit);
462
+		return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
463
+	}
464
+
465
+
466
+	/**
467
+	 * Gets all the datetimes for a ticket (including trashed ones, for now), ordered by the DTT_order for the
468
+	 * datetimes.
469
+	 *
470
+	 * @param int      $TKT_ID           ID of ticket to retrieve the datetimes for
471
+	 * @param boolean  $include_expired  whether to include expired datetimes or not
472
+	 * @param boolean  $include_deleted  whether to include trashed datetimes or not.
473
+	 * @param int|null $limit            if null, no limit, if int then limit results by
474
+	 *                                   that number
475
+	 * @return EE_Datetime[]
476
+	 * @throws EE_Error
477
+	 */
478
+	public function get_datetimes_for_ticket_ordered_by_DTT_order(
479
+		int $TKT_ID,
480
+		bool $include_expired = true,
481
+		bool $include_deleted = true,
482
+		$limit = 0
483
+	) {
484
+		$prev_data_prep_value = $this->prepModelForQuery();
485
+		$where_params         = ['Ticket.TKT_ID' => absint($TKT_ID)];
486
+		$query_params[0]      = $this->addDefaultWhereParams($where_params, $include_deleted, $include_expired);
487
+		$query_params         = $this->addDefaultQueryParams($query_params, $limit, 'DTT_order');
488
+		return $this->getDatetimesAndRestoreModel($query_params, $prev_data_prep_value);
489
+	}
490
+
491
+
492
+	/**
493
+	 * Gets the most important datetime for a particular event (ie, the primary event usually. But if for some WACK
494
+	 * reason it doesn't exist, we consider the earliest event the most important)
495
+	 *
496
+	 * @param int $EVT_ID
497
+	 * @return EE_Datetime
498
+	 * @throws EE_Error
499
+	 */
500
+	public function get_most_important_datetime_for_event(int $EVT_ID)
501
+	{
502
+		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
503
+		if ($results) {
504
+			return array_shift($results);
505
+		}
506
+		return null;
507
+	}
508
+
509
+
510
+	/**
511
+	 * This returns a wpdb->results        Array of all DTT month and years matching the incoming query params and
512
+	 * grouped by month and year.
513
+	 *
514
+	 * @param array  $where_params       @see
515
+	 *                                   https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md#0-where-conditions
516
+	 * @param string $evt_active_status  A string representing the evt active status to filter the months by.
517
+	 *                                   Can be:
518
+	 *                                   - '' = no filter
519
+	 *                                   - upcoming = Published events with at least one upcoming datetime.
520
+	 *                                   - expired = Events with all datetimes expired.
521
+	 *                                   - active = Events that are published and have at least one datetime that
522
+	 *                                   starts before now and ends after now.
523
+	 *                                   - inactive = Events that are either not published.
524
+	 * @return stdClass[]
525
+	 * @throws EE_Error
526
+	 * @throws InvalidArgumentException
527
+	 * @throws InvalidArgumentException
528
+	 */
529
+	public function get_dtt_months_and_years(array $where_params, $evt_active_status = '')
530
+	{
531
+		$current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
532
+		$current_time_for_DTT_EVT_end   = $this->current_time_for_query('DTT_EVT_end');
533
+		switch ($evt_active_status) {
534
+			case 'upcoming':
535
+				$where_params['Event.status'] = 'publish';
536
+				// if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
537
+				if (isset($where_params['DTT_EVT_start'])) {
538
+					$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
539
+				}
540
+				$where_params['DTT_EVT_start'] = ['>', $current_time_for_DTT_EVT_start];
541
+				break;
542
+			case 'expired':
543
+				if (isset($where_params['Event.status'])) {
544
+					unset($where_params['Event.status']);
545
+				}
546
+				// get events to exclude
547
+				$exclude_query[0] = array_merge(
548
+					$where_params,
549
+					['DTT_EVT_end' => ['>', $current_time_for_DTT_EVT_end]]
550
+				);
551
+				// first get all events that have datetimes where its not expired.
552
+				$event_ids = $this->_get_all_wpdb_results(
553
+					$exclude_query,
554
+					OBJECT_K,
555
+					'Datetime.EVT_ID'
556
+				);
557
+				$event_ids = array_keys($event_ids);
558
+				if (isset($where_params['DTT_EVT_end'])) {
559
+					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
560
+				}
561
+				$where_params['DTT_EVT_end']  = ['<', $current_time_for_DTT_EVT_end];
562
+				$where_params['Event.EVT_ID'] = ['NOT IN', $event_ids];
563
+				break;
564
+			case 'active':
565
+				$where_params['Event.status'] = 'publish';
566
+				if (isset($where_params['DTT_EVT_start'])) {
567
+					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
568
+				}
569
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
570
+					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
571
+				}
572
+				$where_params['DTT_EVT_start'] = ['<', $current_time_for_DTT_EVT_start];
573
+				$where_params['DTT_EVT_end']   = ['>', $current_time_for_DTT_EVT_end];
574
+				break;
575
+			case 'inactive':
576
+				if (isset($where_params['Event.status'])) {
577
+					unset($where_params['Event.status']);
578
+				}
579
+				if (isset($where_params['OR'])) {
580
+					$where_params['AND']['OR'] = $where_params['OR'];
581
+				}
582
+				if (isset($where_params['DTT_EVT_end'])) {
583
+					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
584
+					unset($where_params['DTT_EVT_end']);
585
+				}
586
+				if (isset($where_params['DTT_EVT_start'])) {
587
+					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
588
+					unset($where_params['DTT_EVT_start']);
589
+				}
590
+				$where_params['AND']['Event.status'] = ['!=', 'publish'];
591
+				break;
592
+		}
593
+		$query_params[0]          = $where_params;
594
+		$query_params['group_by'] = ['dtt_year', 'dtt_month'];
595
+		$query_params             = $this->addOrderByQueryParams($query_params, 'DTT_EVT_start', 'DESC');
596
+
597
+		$query_interval    = EEH_DTT_Helper::get_sql_query_interval_for_offset(
598
+			$this->get_timezone(),
599
+			'DTT_EVT_start'
600
+		);
601
+		$columns_to_select = [
602
+			'dtt_year'      => ['YEAR(' . $query_interval . ')', '%s'],
603
+			'dtt_month'     => ['MONTHNAME(' . $query_interval . ')', '%s'],
604
+			'dtt_month_num' => ['MONTH(' . $query_interval . ')', '%s'],
605
+		];
606
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
607
+	}
608
+
609
+
610
+	/**
611
+	 * Updates the DTT_sold attribute on each datetime (based on the registrations
612
+	 * for the tickets for each datetime)
613
+	 *
614
+	 * @param EE_Base_Class[]|EE_Datetime[] $datetimes
615
+	 * @throws EE_Error
616
+	 * @throws ReflectionException
617
+	 */
618
+	public function update_sold(array $datetimes)
619
+	{
620
+		EE_Error::doing_it_wrong(
621
+			__FUNCTION__,
622
+			esc_html__(
623
+				'Please use \EEM_Ticket::update_tickets_sold() instead which will in turn correctly update both the Ticket AND Datetime counts.',
624
+				'event_espresso'
625
+			),
626
+			'4.9.32.rc.005'
627
+		);
628
+		foreach ($datetimes as $datetime) {
629
+			$datetime->update_sold();
630
+		}
631
+	}
632
+
633
+
634
+	/**
635
+	 *    Gets the total number of tickets available at a particular datetime
636
+	 *    (does NOT take into account the datetime's spaces available)
637
+	 *
638
+	 * @param int   $DTT_ID
639
+	 * @param array $query_params
640
+	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO
641
+	 *             tickets attached to datetime then FALSE is returned.
642
+	 * @throws EE_Error
643
+	 * @throws ReflectionException
644
+	 */
645
+	public function sum_tickets_currently_available_at_datetime(int $DTT_ID, array $query_params = [])
646
+	{
647
+		$datetime = $this->get_one_by_ID($DTT_ID);
648
+		if ($datetime instanceof EE_Datetime) {
649
+			return $datetime->tickets_remaining($query_params);
650
+		}
651
+		return 0;
652
+	}
653
+
654
+
655
+	/**
656
+	 * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
657
+	 *
658
+	 * @param array $stati_to_include  If included you can restrict the statuses we return counts for by including the
659
+	 *                                 stati you want counts for as values in the array.  An empty array returns counts
660
+	 *                                 for all valid stati.
661
+	 * @param array $query_params      If included can be used to refine the conditions for returning the count (i.e.
662
+	 *                                 only for Datetimes connected to a specific event, or specific ticket.
663
+	 * @return array  The value returned is an array indexed by Datetime Status and the values are the counts.  The
664
+	 * @throws EE_Error
665
+	 *                                 stati used as index keys are: EE_Datetime::active EE_Datetime::upcoming
666
+	 *                                 EE_Datetime::expired
667
+	 */
668
+	public function get_datetime_counts_by_status(array $stati_to_include = [], array $query_params = [])
669
+	{
670
+		// only accept where conditions for this query.
671
+		$_where            = isset($query_params[0]) ? $query_params[0] : [];
672
+		$status_query_args = [
673
+			EE_Datetime::active   => array_merge(
674
+				$_where,
675
+				['DTT_EVT_start' => ['<', time()], 'DTT_EVT_end' => ['>', time()]]
676
+			),
677
+			EE_Datetime::upcoming => array_merge(
678
+				$_where,
679
+				['DTT_EVT_start' => ['>', time()]]
680
+			),
681
+			EE_Datetime::expired  => array_merge(
682
+				$_where,
683
+				['DTT_EVT_end' => ['<', time()]]
684
+			),
685
+		];
686
+		if (! empty($stati_to_include)) {
687
+			foreach (array_keys($status_query_args) as $status) {
688
+				if (! in_array($status, $stati_to_include, true)) {
689
+					unset($status_query_args[ $status ]);
690
+				}
691
+			}
692
+		}
693
+		// loop through and query counts for each stati.
694
+		$status_query_results = [];
695
+		foreach ($status_query_args as $status => $status_where_conditions) {
696
+			$status_query_results[ $status ] = EEM_Datetime::count(
697
+				[$status_where_conditions],
698
+				'DTT_ID',
699
+				true
700
+			);
701
+		}
702
+		return $status_query_results;
703
+	}
704
+
705
+
706
+	/**
707
+	 * Returns the specific count for a given Datetime status matching any given query_params.
708
+	 *
709
+	 * @param string $status Valid string representation for Datetime status requested. (Defaults to Active).
710
+	 * @param array  $query_params
711
+	 * @return int
712
+	 * @throws EE_Error
713
+	 */
714
+	public function get_datetime_count_for_status($status = EE_Datetime::active, array $query_params = [])
715
+	{
716
+		$count = $this->get_datetime_counts_by_status([$status], $query_params);
717
+		return ! empty($count[ $status ]) ? $count[ $status ] : 0;
718
+	}
719
+
720
+
721
+	/**
722
+	 * @return bool|int
723
+	 * @since   $VID:$
724
+	 */
725
+	private function prepModelForQuery()
726
+	{
727
+		$prev_data_prep_value = $this->get_assumption_concerning_values_already_prepared_by_model_object();
728
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
729
+		return $prev_data_prep_value;
730
+	}
731
+
732
+
733
+	/**
734
+	 * @param array    $query_params
735
+	 * @param bool|int $prev_data_prep_value
736
+	 * @return EE_Base_Class[]|EE_Datetime[]
737
+	 * @throws EE_Error
738
+	 * @since   $VID:$
739
+	 */
740
+	private function getDatetimesAndRestoreModel(array $query_params, $prev_data_prep_value)
741
+	{
742
+		$result = $this->get_all($query_params);
743
+		$this->assume_values_already_prepared_by_model_object($prev_data_prep_value);
744
+		return $result;
745
+	}
746
+
747
+
748
+	/**
749
+	 * @param array  $query_params
750
+	 * @param int    $limit
751
+	 * @param string $order_by
752
+	 * @param string $order
753
+	 * @return array
754
+	 * @since   $VID:$
755
+	 */
756
+	private function addDefaultQueryParams(array $query_params, $limit = 0, $order_by = 'DTT_EVT_start', $order = 'ASC')
757
+	{
758
+		$query_params = $this->addOrderByQueryParams($query_params, $order_by, $order);
759
+		$query_params = $this->addLimitQueryParams($query_params, $limit);
760
+		return $query_params;
761
+	}
762
+
763
+
764
+	/**
765
+	 * @param array  $query_params
766
+	 * @param string $default_where_conditions
767
+	 * @return array
768
+	 * @since   $VID:$
769
+	 */
770
+	private function addDefaultWhereConditions(
771
+		array $query_params,
772
+		$default_where_conditions = EEM_Base::default_where_conditions_none
773
+	) {
774
+		$query_params['default_where_conditions'] = $default_where_conditions;
775
+		return $query_params;
776
+	}
777
+
778
+
779
+	/**
780
+	 * @param array $where_params
781
+	 * @param bool  $include_deleted
782
+	 * @param bool  $include_expired
783
+	 * @return array
784
+	 * @since   $VID:$
785
+	 */
786
+	private function addDefaultWhereParams(array $where_params, bool $include_deleted = true, bool $include_expired = true)
787
+	{
788
+		$where_params = $this->addExpiredWhereParams($where_params, $include_expired);
789
+		$where_params = $this->addDeletedWhereParams($where_params, $include_deleted);
790
+		return $where_params;
791
+	}
792
+
793
+
794
+	/**
795
+	 * @param array $where_params
796
+	 * @param bool  $include_deleted
797
+	 * @return array
798
+	 * @since   $VID:$
799
+	 */
800
+	private function addDeletedWhereParams(array $where_params, bool $include_deleted = true)
801
+	{
802
+		$deleted                     = $include_deleted ? [true, false] : [false];
803
+		$where_params['DTT_deleted'] = ['IN', $deleted];
804
+		return $where_params;
805
+	}
806
+
807
+
808
+	/**
809
+	 * @param array $where_params
810
+	 * @param bool  $include_expired
811
+	 * @return array
812
+	 * @since   $VID:$
813
+	 */
814
+	private function addExpiredWhereParams(array $where_params, bool $include_expired = true)
815
+	{
816
+		if (! $include_expired) {
817
+			$where_params['DTT_EVT_end'] = ['>=', current_time('mysql', true)];
818
+		}
819
+		return $where_params;
820
+	}
821
+
822
+
823
+	/**
824
+	 * @param array $query_params
825
+	 * @param int   $limit
826
+	 * @return array
827
+	 * @since   $VID:$
828
+	 */
829
+	private function addLimitQueryParams(array $query_params, $limit = 0)
830
+	{
831
+		if ($limit) {
832
+			$query_params['limit'] = $limit;
833
+		}
834
+		return $query_params;
835
+	}
836
+
837
+
838
+	/**
839
+	 * @param array  $query_params
840
+	 * @param string $order_by
841
+	 * @param string $order
842
+	 * @return array
843
+	 * @since   $VID:$
844
+	 */
845
+	private function addOrderByQueryParams(array $query_params, $order_by = 'DTT_EVT_start', $order = 'ASC')
846
+	{
847
+		$order                    = $order === 'ASC' ? 'ASC' : 'DESC';
848
+		$valid_order_columns      = ['DTT_ID', 'DTT_EVT_start', 'DTT_EVT_end', 'DTT_order'];
849
+		$order_by                 = in_array($order_by, $valid_order_columns, true) ? $order_by : 'DTT_EVT_start';
850
+		$query_params['order_by'] = [$order_by => $order];
851
+		return $query_params;
852
+	}
853 853
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_11_0.dms.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      */
58 58
     public function schema_changes_before_migration()
59 59
     {
60
-        require_once EE_HELPERS . 'EEH_Activation.helper.php';
60
+        require_once EE_HELPERS.'EEH_Activation.helper.php';
61 61
 
62 62
         $table_name = 'esp_answer';
63 63
         $sql        = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
Please login to merge, or discard this patch.
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -13,63 +13,63 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class EE_DMS_Core_4_11_0 extends EE_Data_Migration_Script_Base
15 15
 {
16
-    /**
17
-     *
18
-     * @param EE_DMS_Core_4_10_0 $dms_4_10
19
-     * @param TableManager|null  $table_manager
20
-     * @param TableAnalysis|null $table_analysis
21
-     */
22
-    public function __construct(
23
-        EE_DMS_Core_4_10_0 $dms_4_10,
24
-        TableManager $table_manager = null,
25
-        TableAnalysis $table_analysis = null
26
-    ) {
27
-        $this->previous_dms      = $dms_4_10;
28
-        $this->_pretty_name      = esc_html__("Data Update to Event Espresso 4.11.0", "event_espresso");
29
-        $this->_priority         = 10;
30
-        $this->_migration_stages = [
31
-
32
-        ];
33
-        parent::__construct($table_manager, $table_analysis);
34
-    }
35
-
36
-
37
-    /**
38
-     * Whether to migrate or not.
39
-     *
40
-     * @param array $version_array
41
-     * @return bool
42
-     */
43
-    public function can_migrate_from_version($version_array)
44
-    {
45
-        $version_string = $version_array['Core'];
46
-        return $version_string
47
-               && version_compare($version_string, '4.11.0.decaf', '<')
48
-               && version_compare($version_string, '4.10.0.decaf', '>=');
49
-    }
50
-
51
-
52
-    /**
53
-     * @return bool
54
-     * @throws EE_Error
55
-     * @throws ReflectionException
56
-     */
57
-    public function schema_changes_before_migration()
58
-    {
59
-        require_once EE_HELPERS . 'EEH_Activation.helper.php';
60
-
61
-        $table_name = 'esp_answer';
62
-        $sql        = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
16
+	/**
17
+	 *
18
+	 * @param EE_DMS_Core_4_10_0 $dms_4_10
19
+	 * @param TableManager|null  $table_manager
20
+	 * @param TableAnalysis|null $table_analysis
21
+	 */
22
+	public function __construct(
23
+		EE_DMS_Core_4_10_0 $dms_4_10,
24
+		TableManager $table_manager = null,
25
+		TableAnalysis $table_analysis = null
26
+	) {
27
+		$this->previous_dms      = $dms_4_10;
28
+		$this->_pretty_name      = esc_html__("Data Update to Event Espresso 4.11.0", "event_espresso");
29
+		$this->_priority         = 10;
30
+		$this->_migration_stages = [
31
+
32
+		];
33
+		parent::__construct($table_manager, $table_analysis);
34
+	}
35
+
36
+
37
+	/**
38
+	 * Whether to migrate or not.
39
+	 *
40
+	 * @param array $version_array
41
+	 * @return bool
42
+	 */
43
+	public function can_migrate_from_version($version_array)
44
+	{
45
+		$version_string = $version_array['Core'];
46
+		return $version_string
47
+			   && version_compare($version_string, '4.11.0.decaf', '<')
48
+			   && version_compare($version_string, '4.10.0.decaf', '>=');
49
+	}
50
+
51
+
52
+	/**
53
+	 * @return bool
54
+	 * @throws EE_Error
55
+	 * @throws ReflectionException
56
+	 */
57
+	public function schema_changes_before_migration()
58
+	{
59
+		require_once EE_HELPERS . 'EEH_Activation.helper.php';
60
+
61
+		$table_name = 'esp_answer';
62
+		$sql        = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
63 63
 					REG_ID int(10) unsigned NOT NULL,
64 64
 					QST_ID int(10) unsigned NOT NULL,
65 65
 					ANS_value text NOT NULL,
66 66
 					PRIMARY KEY  (ANS_ID),
67 67
 					KEY REG_ID (REG_ID),
68 68
 					KEY QST_ID (QST_ID)";
69
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
69
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
70 70
 
71
-        $table_name = 'esp_attendee_meta';
72
-        $sql        = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
71
+		$table_name = 'esp_attendee_meta';
72
+		$sql        = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
73 73
 				ATT_ID bigint(20) unsigned NOT NULL,
74 74
 				ATT_fname varchar(45) NOT NULL,
75 75
 				ATT_lname varchar(45) NOT NULL,
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 				KEY ATT_email (ATT_email(191)),
87 87
 				KEY ATT_lname (ATT_lname),
88 88
 				KEY ATT_fname (ATT_fname)";
89
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
89
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
90 90
 
91
-        $table_name = 'esp_checkin';
92
-        $sql        = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
91
+		$table_name = 'esp_checkin';
92
+		$sql        = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
93 93
 				REG_ID int(10) unsigned NOT NULL,
94 94
 				DTT_ID int(10) unsigned NOT NULL,
95 95
 				CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 				PRIMARY KEY  (CHK_ID),
98 98
 				KEY REG_ID (REG_ID),
99 99
 				KEY DTT_ID (DTT_ID)";
100
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
100
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
101 101
 
102
-        $table_name = 'esp_country';
103
-        $sql        = "CNT_ISO varchar(2) NOT NULL,
102
+		$table_name = 'esp_country';
103
+		$sql        = "CNT_ISO varchar(2) NOT NULL,
104 104
 				CNT_ISO3 varchar(3) NOT NULL,
105 105
 				RGN_ID tinyint(3) unsigned DEFAULT NULL,
106 106
 				CNT_name varchar(45) NOT NULL,
@@ -116,32 +116,32 @@  discard block
 block discarded – undo
116 116
 				CNT_is_EU tinyint(1) DEFAULT '0',
117 117
 				CNT_active tinyint(1) DEFAULT '0',
118 118
 				PRIMARY KEY  (CNT_ISO)";
119
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
119
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
120 120
 
121
-        $table_name = 'esp_currency';
122
-        $sql        = "CUR_code varchar(6) NOT NULL,
121
+		$table_name = 'esp_currency';
122
+		$sql        = "CUR_code varchar(6) NOT NULL,
123 123
 				CUR_single varchar(45) DEFAULT 'dollar',
124 124
 				CUR_plural varchar(45) DEFAULT 'dollars',
125 125
 				CUR_sign varchar(45) DEFAULT '$',
126 126
 				CUR_dec_plc varchar(1) NOT NULL DEFAULT '2',
127 127
 				CUR_active tinyint(1) DEFAULT '0',
128 128
 				PRIMARY KEY  (CUR_code)";
129
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
130
-
131
-        // note: although this table is no longer in use,
132
-        // it hasn't been removed because then queries to the model will have errors.
133
-        // but you should expect this table and its corresponding model to be removed in
134
-        // the next few months
135
-        $table_name = 'esp_currency_payment_method';
136
-        $sql        = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
129
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
130
+
131
+		// note: although this table is no longer in use,
132
+		// it hasn't been removed because then queries to the model will have errors.
133
+		// but you should expect this table and its corresponding model to be removed in
134
+		// the next few months
135
+		$table_name = 'esp_currency_payment_method';
136
+		$sql        = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
137 137
 				CUR_code varchar(6) NOT NULL,
138 138
 				PMD_ID int(11) NOT NULL,
139 139
 				PRIMARY KEY  (CPM_ID),
140 140
 				KEY PMD_ID (PMD_ID)";
141
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
141
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
142 142
 
143
-        $table_name = 'esp_datetime';
144
-        $sql        = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
143
+		$table_name = 'esp_datetime';
144
+		$sql        = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
145 145
 				EVT_ID bigint(20) unsigned NOT NULL,
146 146
 				DTT_name varchar(255) NOT NULL DEFAULT '',
147 147
 				DTT_description text NOT NULL,
@@ -158,28 +158,28 @@  discard block
 block discarded – undo
158 158
 				KEY DTT_EVT_start (DTT_EVT_start),
159 159
 				KEY EVT_ID (EVT_ID),
160 160
 				KEY DTT_is_primary (DTT_is_primary)";
161
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
161
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
162 162
 
163
-        $table_name = "esp_datetime_ticket";
164
-        $sql        = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
163
+		$table_name = "esp_datetime_ticket";
164
+		$sql        = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
165 165
 				DTT_ID int(10) unsigned NOT NULL,
166 166
 				TKT_ID int(10) unsigned NOT NULL,
167 167
 				PRIMARY KEY  (DTK_ID),
168 168
 				KEY DTT_ID (DTT_ID),
169 169
 				KEY TKT_ID (TKT_ID)";
170
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
170
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
171 171
 
172
-        $table_name = 'esp_event_message_template';
173
-        $sql        = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
172
+		$table_name = 'esp_event_message_template';
173
+		$sql        = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
174 174
 				EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
175 175
 				GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
176 176
 				PRIMARY KEY  (EMT_ID),
177 177
 				KEY EVT_ID (EVT_ID),
178 178
 				KEY GRP_ID (GRP_ID)";
179
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
179
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
180 180
 
181
-        $table_name = 'esp_event_meta';
182
-        $sql        = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
181
+		$table_name = 'esp_event_meta';
182
+		$sql        = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
183 183
 				EVT_ID bigint(20) unsigned NOT NULL,
184 184
 				EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
185 185
 				EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 				EVT_donations tinyint(1) NULL,
195 195
 				PRIMARY KEY  (EVTM_ID),
196 196
 				KEY EVT_ID (EVT_ID)";
197
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
197
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
198 198
 
199
-        $table_name = 'esp_event_question_group';
200
-        $sql        = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
199
+		$table_name = 'esp_event_question_group';
200
+		$sql        = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
201 201
 				EVT_ID bigint(20) unsigned NOT NULL,
202 202
 				QSG_ID int(10) unsigned NOT NULL,
203 203
 				EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
@@ -205,28 +205,28 @@  discard block
 block discarded – undo
205 205
 				PRIMARY KEY  (EQG_ID),
206 206
 				KEY EVT_ID (EVT_ID),
207 207
 				KEY QSG_ID (QSG_ID)";
208
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209 209
 
210
-        $table_name = 'esp_event_venue';
211
-        $sql        = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
210
+		$table_name = 'esp_event_venue';
211
+		$sql        = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
212 212
 				EVT_ID bigint(20) unsigned NOT NULL,
213 213
 				VNU_ID bigint(20) unsigned NOT NULL,
214 214
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
215 215
 				PRIMARY KEY  (EVV_ID)";
216
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
216
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
217 217
 
218
-        $table_name = 'esp_extra_meta';
219
-        $sql        = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
218
+		$table_name = 'esp_extra_meta';
219
+		$sql        = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
220 220
 				OBJ_ID int(11) DEFAULT NULL,
221 221
 				EXM_type varchar(45) DEFAULT NULL,
222 222
 				EXM_key varchar(45) DEFAULT NULL,
223 223
 				EXM_value text,
224 224
 				PRIMARY KEY  (EXM_ID),
225 225
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
226
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
226
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
227 227
 
228
-        $table_name = 'esp_extra_join';
229
-        $sql        = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
228
+		$table_name = 'esp_extra_join';
229
+		$sql        = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
230 230
 				EXJ_first_model_id varchar(6) NOT NULL,
231 231
 				EXJ_first_model_name varchar(20) NOT NULL,
232 232
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 				PRIMARY KEY  (EXJ_ID),
235 235
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
236 236
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
237
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
237
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
238 238
 
239
-        $now_in_mysql = current_time('mysql', true);
240
-        $table_name   = 'esp_line_item';
241
-        $sql          = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
239
+		$now_in_mysql = current_time('mysql', true);
240
+		$table_name   = 'esp_line_item';
241
+		$sql          = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
242 242
 				LIN_code varchar(245) NOT NULL DEFAULT '',
243 243
 				TXN_ID int(11) DEFAULT NULL,
244 244
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 				KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp),
260 260
 				KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type),
261 261
 				KEY obj_id_obj_type (OBJ_ID,OBJ_type)";
262
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
262
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
263 263
 
264
-        $table_name = 'esp_log';
265
-        $sql        = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
264
+		$table_name = 'esp_log';
265
+		$sql        = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
266 266
 				LOG_time datetime DEFAULT NULL,
267 267
 				OBJ_ID varchar(45) DEFAULT NULL,
268 268
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 				KEY LOG_time (LOG_time),
274 274
 				KEY OBJ (OBJ_type,OBJ_ID),
275 275
 				KEY LOG_type (LOG_type)";
276
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
276
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
277 277
 
278
-        $table_name = 'esp_message';
279
-        $sql        = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
278
+		$table_name = 'esp_message';
279
+		$sql        = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
280 280
 				GRP_ID int(10) unsigned NULL,
281 281
 				MSG_token varchar(255) NULL,
282 282
 				TXN_ID int(10) unsigned NULL,
@@ -308,20 +308,20 @@  discard block
 block discarded – undo
308 308
 				KEY STS_ID (STS_ID),
309 309
 				KEY MSG_created (MSG_created),
310 310
 				KEY MSG_modified (MSG_modified)";
311
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
311
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
312 312
 
313
-        $table_name = 'esp_message_template';
314
-        $sql        = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
313
+		$table_name = 'esp_message_template';
314
+		$sql        = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
315 315
 				GRP_ID int(10) unsigned NOT NULL,
316 316
 				MTP_context varchar(50) NOT NULL,
317 317
 				MTP_template_field varchar(30) NOT NULL,
318 318
 				MTP_content text NOT NULL,
319 319
 				PRIMARY KEY  (MTP_ID),
320 320
 				KEY GRP_ID (GRP_ID)";
321
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
321
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
322 322
 
323
-        $table_name = 'esp_message_template_group';
324
-        $sql        = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
323
+		$table_name = 'esp_message_template_group';
324
+		$sql        = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
325 325
 				MTP_user_id int(10) NOT NULL DEFAULT '1',
326 326
 				MTP_name varchar(245) NOT NULL DEFAULT '',
327 327
 				MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
334 334
 				PRIMARY KEY  (GRP_ID),
335 335
 				KEY MTP_user_id (MTP_user_id)";
336
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
336
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
337 337
 
338
-        $table_name = 'esp_payment';
339
-        $sql        = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
338
+		$table_name = 'esp_payment';
339
+		$sql        = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
340 340
 				TXN_ID int(10) unsigned DEFAULT NULL,
341 341
 				STS_ID varchar(3) DEFAULT NULL,
342 342
 				PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
 				PRIMARY KEY  (PAY_ID),
354 354
 				KEY PAY_timestamp (PAY_timestamp),
355 355
 				KEY TXN_ID (TXN_ID)";
356
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
356
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
357 357
 
358
-        $table_name = 'esp_payment_method';
359
-        $sql        = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
358
+		$table_name = 'esp_payment_method';
359
+		$sql        = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
360 360
 				PMD_type varchar(124) DEFAULT NULL,
361 361
 				PMD_name varchar(255) DEFAULT NULL,
362 362
 				PMD_desc text,
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 				PRIMARY KEY  (PMD_ID),
373 373
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
374 374
 				KEY PMD_type (PMD_type)";
375
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
375
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
376 376
 
377
-        $table_name = "esp_price";
378
-        $sql        = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
377
+		$table_name = "esp_price";
378
+		$sql        = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
379 379
 				PRT_ID tinyint(3) unsigned NOT NULL,
380 380
 				PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00',
381 381
 				PRC_name varchar(245) NOT NULL,
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 				PRC_parent int(10) unsigned DEFAULT 0,
389 389
 				PRIMARY KEY  (PRC_ID),
390 390
 				KEY PRT_ID (PRT_ID)";
391
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
391
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
392 392
 
393
-        $table_name = "esp_price_type";
394
-        $sql        = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
393
+		$table_name = "esp_price_type";
394
+		$sql        = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
395 395
 				PRT_name varchar(45) NOT NULL,
396 396
 				PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
397 397
 				PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -400,27 +400,27 @@  discard block
 block discarded – undo
400 400
 				PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
401 401
 				UNIQUE KEY PRT_name_UNIQUE (PRT_name),
402 402
 				PRIMARY KEY  (PRT_ID)";
403
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
403
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
404 404
 
405
-        $table_name = "esp_ticket_price";
406
-        $sql        = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
405
+		$table_name = "esp_ticket_price";
406
+		$sql        = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
407 407
 				TKT_ID int(10) unsigned NOT NULL,
408 408
 				PRC_ID int(10) unsigned NOT NULL,
409 409
 				PRIMARY KEY  (TKP_ID),
410 410
 				KEY TKT_ID (TKT_ID),
411 411
 				KEY PRC_ID (PRC_ID)";
412
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
412
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
413 413
 
414
-        $table_name = "esp_ticket_template";
415
-        $sql        = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
414
+		$table_name = "esp_ticket_template";
415
+		$sql        = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
416 416
 				TTM_name varchar(45) NOT NULL,
417 417
 				TTM_description text,
418 418
 				TTM_file varchar(45),
419 419
 				PRIMARY KEY  (TTM_ID)";
420
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
420
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
421 421
 
422
-        $table_name = 'esp_question';
423
-        $sql        = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
422
+		$table_name = 'esp_question';
423
+		$sql        = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
424 424
 				QST_display_text text NOT NULL,
425 425
 				QST_admin_label varchar(255) NOT NULL,
426 426
 				QST_system varchar(25) DEFAULT NULL,
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
435 435
 				PRIMARY KEY  (QST_ID),
436 436
 				KEY QST_order (QST_order)';
437
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
437
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
438 438
 
439
-        $table_name = 'esp_question_group';
440
-        $sql        = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
439
+		$table_name = 'esp_question_group';
440
+		$sql        = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
441 441
 				QSG_name varchar(255) NOT NULL,
442 442
 				QSG_identifier varchar(100) NOT NULL,
443 443
 				QSG_desc text NULL,
@@ -450,20 +450,20 @@  discard block
 block discarded – undo
450 450
 				PRIMARY KEY  (QSG_ID),
451 451
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
452 452
 				KEY QSG_order (QSG_order)';
453
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
453
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
454 454
 
455
-        $table_name = 'esp_question_group_question';
456
-        $sql        = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
455
+		$table_name = 'esp_question_group_question';
456
+		$sql        = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
457 457
 				QSG_ID int(10) unsigned NOT NULL,
458 458
 				QST_ID int(10) unsigned NOT NULL,
459 459
 				QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
460 460
 				PRIMARY KEY  (QGQ_ID),
461 461
 				KEY QST_ID (QST_ID),
462 462
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
463
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
463
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
464 464
 
465
-        $table_name = 'esp_question_option';
466
-        $sql        = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
465
+		$table_name = 'esp_question_option';
466
+		$sql        = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
467 467
 				QSO_value varchar(255) NOT NULL,
468 468
 				QSO_desc text NOT NULL,
469 469
 				QST_ID int(10) unsigned NOT NULL,
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
 				PRIMARY KEY  (QSO_ID),
474 474
 				KEY QST_ID (QST_ID),
475 475
 				KEY QSO_order (QSO_order)";
476
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
476
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
477 477
 
478
-        $table_name = 'esp_registration';
479
-        $sql        = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
478
+		$table_name = 'esp_registration';
479
+		$sql        = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
480 480
 				EVT_ID bigint(20) unsigned NOT NULL,
481 481
 				ATT_ID bigint(20) unsigned NOT NULL,
482 482
 				TXN_ID int(10) unsigned NOT NULL,
@@ -500,20 +500,20 @@  discard block
 block discarded – undo
500 500
 				KEY TKT_ID (TKT_ID),
501 501
 				KEY EVT_ID (EVT_ID),
502 502
 				KEY STS_ID (STS_ID)";
503
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
503
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
504 504
 
505
-        $table_name = 'esp_registration_payment';
506
-        $sql        = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
505
+		$table_name = 'esp_registration_payment';
506
+		$sql        = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
507 507
 					  REG_ID int(10) unsigned NOT NULL,
508 508
 					  PAY_ID int(10) unsigned NULL,
509 509
 					  RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00',
510 510
 					  PRIMARY KEY  (RPY_ID),
511 511
 					  KEY REG_ID (REG_ID),
512 512
 					  KEY PAY_ID (PAY_ID)";
513
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
513
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
514 514
 
515
-        $table_name = 'esp_state';
516
-        $sql        = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
515
+		$table_name = 'esp_state';
516
+		$sql        = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
517 517
 				CNT_ISO varchar(2) NOT NULL,
518 518
 				STA_abbrev varchar(24) NOT NULL,
519 519
 				STA_name varchar(100) NOT NULL,
@@ -521,10 +521,10 @@  discard block
 block discarded – undo
521 521
 				PRIMARY KEY  (STA_ID),
522 522
 				KEY STA_abbrev (STA_abbrev),
523 523
 				KEY CNT_ISO (CNT_ISO)";
524
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
524
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
525 525
 
526
-        $table_name = 'esp_status';
527
-        $sql        = "STS_ID varchar(3) NOT NULL,
526
+		$table_name = 'esp_status';
527
+		$sql        = "STS_ID varchar(3) NOT NULL,
528 528
 				STS_code varchar(45) NOT NULL,
529 529
 				STS_type varchar(45) NOT NULL,
530 530
 				STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 				STS_open tinyint(1) NOT NULL DEFAULT 1,
533 533
 				UNIQUE KEY STS_ID_UNIQUE (STS_ID),
534 534
 				KEY STS_type (STS_type)";
535
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
535
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
536 536
 
537
-        $table_name = "esp_ticket";
538
-        $sql        = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
537
+		$table_name = "esp_ticket";
538
+		$sql        = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
539 539
 				TTM_ID int(10) unsigned NOT NULL,
540 540
 				TKT_name varchar(245) NOT NULL DEFAULT '',
541 541
 				TKT_description text NOT NULL,
@@ -560,10 +560,10 @@  discard block
 block discarded – undo
560 560
 				TKT_visibility smallint(6) unsigned NOT NULL DEFAULT 100,
561 561
 				PRIMARY KEY  (TKT_ID),
562 562
 				KEY TKT_start_date (TKT_start_date)";
563
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
563
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
564 564
 
565
-        $table_name = 'esp_transaction';
566
-        $sql        = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
565
+		$table_name = 'esp_transaction';
566
+		$sql        = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
567 567
 				TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
568 568
 				TXN_total decimal(12,3) DEFAULT '0.00',
569 569
 				TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00',
@@ -575,10 +575,10 @@  discard block
 block discarded – undo
575 575
 				PRIMARY KEY  (TXN_ID),
576 576
 				KEY TXN_timestamp (TXN_timestamp),
577 577
 				KEY STS_ID (STS_ID)";
578
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
578
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
579 579
 
580
-        $table_name = 'esp_venue_meta';
581
-        $sql        = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
580
+		$table_name = 'esp_venue_meta';
581
+		$sql        = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
582 582
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
583 583
 			VNU_address varchar(255) DEFAULT NULL,
584 584
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -597,36 +597,36 @@  discard block
 block discarded – undo
597 597
 			KEY VNU_ID (VNU_ID),
598 598
 			KEY STA_ID (STA_ID),
599 599
 			KEY CNT_ISO (CNT_ISO)";
600
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
601
-
602
-        $this->insert_default_data();
603
-        return true;
604
-    }
605
-
606
-
607
-    /**
608
-     * Inserts default data on new installs
609
-     *
610
-     * @throws EE_Error
611
-     * @throws ReflectionException
612
-     * @since 4.10.0.p
613
-     */
614
-    public function insert_default_data()
615
-    {
616
-        $this->previous_dms->insert_default_data();
617
-    }
618
-
619
-
620
-    /**
621
-     * @return boolean
622
-     */
623
-    public function schema_changes_after_migration()
624
-    {
625
-        return true;
626
-    }
627
-
628
-
629
-    public function migration_page_hooks()
630
-    {
631
-    }
600
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
601
+
602
+		$this->insert_default_data();
603
+		return true;
604
+	}
605
+
606
+
607
+	/**
608
+	 * Inserts default data on new installs
609
+	 *
610
+	 * @throws EE_Error
611
+	 * @throws ReflectionException
612
+	 * @since 4.10.0.p
613
+	 */
614
+	public function insert_default_data()
615
+	{
616
+		$this->previous_dms->insert_default_data();
617
+	}
618
+
619
+
620
+	/**
621
+	 * @return boolean
622
+	 */
623
+	public function schema_changes_after_migration()
624
+	{
625
+		return true;
626
+	}
627
+
628
+
629
+	public function migration_page_hooks()
630
+	{
631
+	}
632 632
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/shared/GQLRequests.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -210,8 +210,8 @@
 block discarded – undo
210 210
      */
211 211
     protected function requestHandler(): bool
212 212
     {
213
-        if (! class_exists('WPGraphQL')) {
214
-            require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
213
+        if ( ! class_exists('WPGraphQL')) {
214
+            require_once EE_THIRD_PARTY.'wp-graphql/wp-graphql.php';
215 215
         }
216 216
         // load handler for EE GraphQL requests
217 217
         $graphQL_manager = $this->loader->getShared(
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -19,231 +19,231 @@
 block discarded – undo
19 19
  */
20 20
 class GQLRequests extends Route
21 21
 {
22
-    /**
23
-     * @var AssetManifestFactory
24
-     */
25
-    private $manifest_factory;
22
+	/**
23
+	 * @var AssetManifestFactory
24
+	 */
25
+	private $manifest_factory;
26 26
 
27 27
 
28
-    /**
29
-     * AssetRequests constructor.
30
-     *
31
-     * @param EE_Dependency_Map    $dependency_map
32
-     * @param LoaderInterface      $loader
33
-     * @param RequestInterface     $request
34
-     * @param AssetManifestFactory $manifest_factory
35
-     */
36
-    public function __construct(
37
-        EE_Dependency_Map $dependency_map,
38
-        LoaderInterface $loader,
39
-        RequestInterface $request,
40
-        AssetManifestFactory $manifest_factory
41
-    ) {
42
-        $this->manifest_factory = $manifest_factory;
43
-        parent::__construct($dependency_map, $loader, $request);
44
-    }
28
+	/**
29
+	 * AssetRequests constructor.
30
+	 *
31
+	 * @param EE_Dependency_Map    $dependency_map
32
+	 * @param LoaderInterface      $loader
33
+	 * @param RequestInterface     $request
34
+	 * @param AssetManifestFactory $manifest_factory
35
+	 */
36
+	public function __construct(
37
+		EE_Dependency_Map $dependency_map,
38
+		LoaderInterface $loader,
39
+		RequestInterface $request,
40
+		AssetManifestFactory $manifest_factory
41
+	) {
42
+		$this->manifest_factory = $manifest_factory;
43
+		parent::__construct($dependency_map, $loader, $request);
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * returns true if the current request matches this route
49
-     *
50
-     * @return bool
51
-     * @since   $VID:$
52
-     */
53
-    public function matchesCurrentRequest(): bool
54
-    {
55
-        global $pagenow;
56
-        return (
57
-                   $this->request->isGQL()
58
-                   || $this->request->isUnitTesting()
59
-                   || (
60
-                       $this->request->isAdmin()
61
-                       && $this->request->getRequestParam('page') === 'espresso_events'
62
-                       && (
63
-                           $this->request->getRequestParam('action') === 'create_new'
64
-                           || $this->request->getRequestParam('action') === 'edit'
65
-                       )
66
-                   )
67
-                   || (
68
-                       $pagenow
69
-                       && (
70
-                           $pagenow === 'post-new.php'
71
-                           || (
72
-                               $pagenow === 'post.php'
73
-                               && $this->request->getRequestParam('action') === 'edit'
74
-                           )
75
-                       )
76
-                   )
77
-               );
78
-    }
47
+	/**
48
+	 * returns true if the current request matches this route
49
+	 *
50
+	 * @return bool
51
+	 * @since   $VID:$
52
+	 */
53
+	public function matchesCurrentRequest(): bool
54
+	{
55
+		global $pagenow;
56
+		return (
57
+				   $this->request->isGQL()
58
+				   || $this->request->isUnitTesting()
59
+				   || (
60
+					   $this->request->isAdmin()
61
+					   && $this->request->getRequestParam('page') === 'espresso_events'
62
+					   && (
63
+						   $this->request->getRequestParam('action') === 'create_new'
64
+						   || $this->request->getRequestParam('action') === 'edit'
65
+					   )
66
+				   )
67
+				   || (
68
+					   $pagenow
69
+					   && (
70
+						   $pagenow === 'post-new.php'
71
+						   || (
72
+							   $pagenow === 'post.php'
73
+							   && $this->request->getRequestParam('action') === 'edit'
74
+						   )
75
+					   )
76
+				   )
77
+			   );
78
+	}
79 79
 
80 80
 
81
-    /**
82
-     * @since $VID:$
83
-     */
84
-    protected function registerDependencies()
85
-    {
86
-        $this->dependency_map->registerDependencies(
87
-            'EventEspresso\core\services\graphql\GraphQLManager',
88
-            [
89
-                'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache,
90
-                'EventEspresso\core\services\graphql\DataLoaderManager'  => EE_Dependency_Map::load_from_cache,
91
-                'EventEspresso\core\services\graphql\EnumsManager'       => EE_Dependency_Map::load_from_cache,
92
-                'EventEspresso\core\services\graphql\InputsManager'      => EE_Dependency_Map::load_from_cache,
93
-                'EventEspresso\core\services\graphql\TypesManager'       => EE_Dependency_Map::load_from_cache,
94
-            ]
95
-        );
96
-        $this->dependency_map->registerDependencies(
97
-            'EventEspresso\core\services\graphql\TypesManager',
98
-            [
99
-                'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache,
100
-            ]
101
-        );
102
-        $this->dependency_map->registerDependencies(
103
-            'EventEspresso\core\services\graphql\InputsManager',
104
-            [
105
-                'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache,
106
-            ]
107
-        );
108
-        $this->dependency_map->registerDependencies(
109
-            'EventEspresso\core\services\graphql\EnumsManager',
110
-            [
111
-                'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache,
112
-            ]
113
-        );
114
-        $this->dependency_map->registerDependencies(
115
-            'EventEspresso\core\services\graphql\ConnectionsManager',
116
-            [
117
-                'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache,
118
-            ]
119
-        );
120
-        $this->dependency_map->registerDependencies(
121
-            'EventEspresso\core\services\graphql\DataLoaderManager',
122
-            [
123
-                'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache,
124
-            ]
125
-        );
126
-        $this->dependency_map->registerDependencies(
127
-            'EventEspresso\core\domain\services\graphql\types\Datetime',
128
-            ['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
129
-        );
130
-        $this->dependency_map->registerDependencies(
131
-            'EventEspresso\core\domain\services\graphql\types\Attendee',
132
-            ['EEM_Attendee' => EE_Dependency_Map::load_from_cache]
133
-        );
134
-        $this->dependency_map->registerDependencies(
135
-            'EventEspresso\core\domain\services\graphql\types\Event',
136
-            ['EEM_Event' => EE_Dependency_Map::load_from_cache]
137
-        );
138
-        $this->dependency_map->registerDependencies(
139
-            'EventEspresso\core\domain\services\graphql\types\FormElement',
140
-            ['EEM_Form_Element' => EE_Dependency_Map::load_from_cache]
141
-        );
142
-        $this->dependency_map->registerDependencies(
143
-            'EventEspresso\core\domain\services\graphql\types\FormSection',
144
-            ['EEM_Form_Section' => EE_Dependency_Map::load_from_cache]
145
-        );
146
-        $this->dependency_map->registerDependencies(
147
-            'EventEspresso\core\domain\services\graphql\types\Ticket',
148
-            ['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
149
-        );
150
-        $this->dependency_map->registerDependencies(
151
-            'EventEspresso\core\domain\services\graphql\types\Price',
152
-            ['EEM_Price' => EE_Dependency_Map::load_from_cache]
153
-        );
154
-        $this->dependency_map->registerDependencies(
155
-            'EventEspresso\core\domain\services\graphql\types\PriceType',
156
-            ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache]
157
-        );
158
-        $this->dependency_map->registerDependencies(
159
-            'EventEspresso\core\domain\services\graphql\types\Venue',
160
-            ['EEM_Venue' => EE_Dependency_Map::load_from_cache]
161
-        );
162
-        $this->dependency_map->registerDependencies(
163
-            'EventEspresso\core\domain\services\graphql\types\State',
164
-            ['EEM_State' => EE_Dependency_Map::load_from_cache]
165
-        );
166
-        $this->dependency_map->registerDependencies(
167
-            'EventEspresso\core\domain\services\graphql\types\Country',
168
-            ['EEM_Country' => EE_Dependency_Map::load_from_cache]
169
-        );
170
-        $this->dependency_map->registerDependencies(
171
-            'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection',
172
-            ['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
173
-        );
174
-        $this->dependency_map->registerDependencies(
175
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection',
176
-            ['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
177
-        );
178
-        $this->dependency_map->registerDependencies(
179
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection',
180
-            ['EEM_Attendee' => EE_Dependency_Map::load_from_cache]
181
-        );
182
-        $this->dependency_map->registerDependencies(
183
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryCountriesConnection',
184
-            ['EEM_Country' => EE_Dependency_Map::load_from_cache]
185
-        );
186
-        $this->dependency_map->registerDependencies(
187
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryFormElementsConnection',
188
-            ['EEM_Form_Element' => EE_Dependency_Map::load_from_cache]
189
-        );
190
-        $this->dependency_map->registerDependencies(
191
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryFormSectionsConnection',
192
-            ['EEM_Form_Section' => EE_Dependency_Map::load_from_cache]
193
-        );
194
-        $this->dependency_map->registerDependencies(
195
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryStatesConnection',
196
-            ['EEM_State' => EE_Dependency_Map::load_from_cache]
197
-        );
198
-        $this->dependency_map->registerDependencies(
199
-            'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection',
200
-            ['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
201
-        );
202
-        $this->dependency_map->registerDependencies(
203
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection',
204
-            ['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
205
-        );
206
-        $this->dependency_map->registerDependencies(
207
-            'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection',
208
-            ['EEM_Price' => EE_Dependency_Map::load_from_cache]
209
-        );
210
-        $this->dependency_map->registerDependencies(
211
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection',
212
-            ['EEM_Price' => EE_Dependency_Map::load_from_cache]
213
-        );
214
-        $this->dependency_map->registerDependencies(
215
-            'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection',
216
-            ['EEM_Price_Type' => EE_Dependency_Map::load_from_cache]
217
-        );
218
-        $this->dependency_map->registerDependencies(
219
-            'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection',
220
-            ['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
221
-        );
222
-        $this->dependency_map->registerDependencies(
223
-            'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection',
224
-            ['EEM_Venue' => EE_Dependency_Map::load_from_cache]
225
-        );
226
-    }
81
+	/**
82
+	 * @since $VID:$
83
+	 */
84
+	protected function registerDependencies()
85
+	{
86
+		$this->dependency_map->registerDependencies(
87
+			'EventEspresso\core\services\graphql\GraphQLManager',
88
+			[
89
+				'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache,
90
+				'EventEspresso\core\services\graphql\DataLoaderManager'  => EE_Dependency_Map::load_from_cache,
91
+				'EventEspresso\core\services\graphql\EnumsManager'       => EE_Dependency_Map::load_from_cache,
92
+				'EventEspresso\core\services\graphql\InputsManager'      => EE_Dependency_Map::load_from_cache,
93
+				'EventEspresso\core\services\graphql\TypesManager'       => EE_Dependency_Map::load_from_cache,
94
+			]
95
+		);
96
+		$this->dependency_map->registerDependencies(
97
+			'EventEspresso\core\services\graphql\TypesManager',
98
+			[
99
+				'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache,
100
+			]
101
+		);
102
+		$this->dependency_map->registerDependencies(
103
+			'EventEspresso\core\services\graphql\InputsManager',
104
+			[
105
+				'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache,
106
+			]
107
+		);
108
+		$this->dependency_map->registerDependencies(
109
+			'EventEspresso\core\services\graphql\EnumsManager',
110
+			[
111
+				'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache,
112
+			]
113
+		);
114
+		$this->dependency_map->registerDependencies(
115
+			'EventEspresso\core\services\graphql\ConnectionsManager',
116
+			[
117
+				'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache,
118
+			]
119
+		);
120
+		$this->dependency_map->registerDependencies(
121
+			'EventEspresso\core\services\graphql\DataLoaderManager',
122
+			[
123
+				'EventEspresso\core\services\graphql\loaders\DataLoaderCollection' => EE_Dependency_Map::load_from_cache,
124
+			]
125
+		);
126
+		$this->dependency_map->registerDependencies(
127
+			'EventEspresso\core\domain\services\graphql\types\Datetime',
128
+			['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
129
+		);
130
+		$this->dependency_map->registerDependencies(
131
+			'EventEspresso\core\domain\services\graphql\types\Attendee',
132
+			['EEM_Attendee' => EE_Dependency_Map::load_from_cache]
133
+		);
134
+		$this->dependency_map->registerDependencies(
135
+			'EventEspresso\core\domain\services\graphql\types\Event',
136
+			['EEM_Event' => EE_Dependency_Map::load_from_cache]
137
+		);
138
+		$this->dependency_map->registerDependencies(
139
+			'EventEspresso\core\domain\services\graphql\types\FormElement',
140
+			['EEM_Form_Element' => EE_Dependency_Map::load_from_cache]
141
+		);
142
+		$this->dependency_map->registerDependencies(
143
+			'EventEspresso\core\domain\services\graphql\types\FormSection',
144
+			['EEM_Form_Section' => EE_Dependency_Map::load_from_cache]
145
+		);
146
+		$this->dependency_map->registerDependencies(
147
+			'EventEspresso\core\domain\services\graphql\types\Ticket',
148
+			['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
149
+		);
150
+		$this->dependency_map->registerDependencies(
151
+			'EventEspresso\core\domain\services\graphql\types\Price',
152
+			['EEM_Price' => EE_Dependency_Map::load_from_cache]
153
+		);
154
+		$this->dependency_map->registerDependencies(
155
+			'EventEspresso\core\domain\services\graphql\types\PriceType',
156
+			['EEM_Price_Type' => EE_Dependency_Map::load_from_cache]
157
+		);
158
+		$this->dependency_map->registerDependencies(
159
+			'EventEspresso\core\domain\services\graphql\types\Venue',
160
+			['EEM_Venue' => EE_Dependency_Map::load_from_cache]
161
+		);
162
+		$this->dependency_map->registerDependencies(
163
+			'EventEspresso\core\domain\services\graphql\types\State',
164
+			['EEM_State' => EE_Dependency_Map::load_from_cache]
165
+		);
166
+		$this->dependency_map->registerDependencies(
167
+			'EventEspresso\core\domain\services\graphql\types\Country',
168
+			['EEM_Country' => EE_Dependency_Map::load_from_cache]
169
+		);
170
+		$this->dependency_map->registerDependencies(
171
+			'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection',
172
+			['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
173
+		);
174
+		$this->dependency_map->registerDependencies(
175
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection',
176
+			['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
177
+		);
178
+		$this->dependency_map->registerDependencies(
179
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryAttendeesConnection',
180
+			['EEM_Attendee' => EE_Dependency_Map::load_from_cache]
181
+		);
182
+		$this->dependency_map->registerDependencies(
183
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryCountriesConnection',
184
+			['EEM_Country' => EE_Dependency_Map::load_from_cache]
185
+		);
186
+		$this->dependency_map->registerDependencies(
187
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryFormElementsConnection',
188
+			['EEM_Form_Element' => EE_Dependency_Map::load_from_cache]
189
+		);
190
+		$this->dependency_map->registerDependencies(
191
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryFormSectionsConnection',
192
+			['EEM_Form_Section' => EE_Dependency_Map::load_from_cache]
193
+		);
194
+		$this->dependency_map->registerDependencies(
195
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryStatesConnection',
196
+			['EEM_State' => EE_Dependency_Map::load_from_cache]
197
+		);
198
+		$this->dependency_map->registerDependencies(
199
+			'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection',
200
+			['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
201
+		);
202
+		$this->dependency_map->registerDependencies(
203
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection',
204
+			['EEM_Ticket' => EE_Dependency_Map::load_from_cache]
205
+		);
206
+		$this->dependency_map->registerDependencies(
207
+			'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection',
208
+			['EEM_Price' => EE_Dependency_Map::load_from_cache]
209
+		);
210
+		$this->dependency_map->registerDependencies(
211
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection',
212
+			['EEM_Price' => EE_Dependency_Map::load_from_cache]
213
+		);
214
+		$this->dependency_map->registerDependencies(
215
+			'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection',
216
+			['EEM_Price_Type' => EE_Dependency_Map::load_from_cache]
217
+		);
218
+		$this->dependency_map->registerDependencies(
219
+			'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection',
220
+			['EEM_Datetime' => EE_Dependency_Map::load_from_cache]
221
+		);
222
+		$this->dependency_map->registerDependencies(
223
+			'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection',
224
+			['EEM_Venue' => EE_Dependency_Map::load_from_cache]
225
+		);
226
+	}
227 227
 
228 228
 
229
-    /**
230
-     * implements logic required to run during request
231
-     *
232
-     * @return bool
233
-     * @since   $VID:$
234
-     */
235
-    protected function requestHandler(): bool
236
-    {
237
-        if (! class_exists('WPGraphQL')) {
238
-            require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
239
-        }
240
-        // load handler for EE GraphQL requests
241
-        $graphQL_manager = $this->loader->getShared(
242
-            'EventEspresso\core\services\graphql\GraphQLManager'
243
-        );
244
-        $graphQL_manager->init();
245
-        $manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain());
246
-        $manifest->initialize();
247
-        return true;
248
-    }
229
+	/**
230
+	 * implements logic required to run during request
231
+	 *
232
+	 * @return bool
233
+	 * @since   $VID:$
234
+	 */
235
+	protected function requestHandler(): bool
236
+	{
237
+		if (! class_exists('WPGraphQL')) {
238
+			require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
239
+		}
240
+		// load handler for EE GraphQL requests
241
+		$graphQL_manager = $this->loader->getShared(
242
+			'EventEspresso\core\services\graphql\GraphQLManager'
243
+		);
244
+		$graphQL_manager->init();
245
+		$manifest = $this->manifest_factory->createFromDomainObject(DomainFactory::getEventEspressoCoreDomain());
246
+		$manifest->initialize();
247
+		return true;
248
+	}
249 249
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/admin/EspressoEventEditor.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,8 +138,8 @@
 block discarded – undo
138 138
      */
139 139
     protected function requestHandler(): bool
140 140
     {
141
-        if (! class_exists('WPGraphQL')) {
142
-            require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
141
+        if ( ! class_exists('WPGraphQL')) {
142
+            require_once EE_THIRD_PARTY.'wp-graphql/wp-graphql.php';
143 143
         }
144 144
         /** @var GraphQLManager $graphQL_manager */
145 145
         $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager');
Please login to merge, or discard this patch.
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -17,128 +17,128 @@
 block discarded – undo
17 17
  */
18 18
 class EspressoEventEditor extends EspressoEventsAdmin
19 19
 {
20
-    /**
21
-     * returns true if the current request matches this route
22
-     *
23
-     * @return bool
24
-     * @since   $VID:$
25
-     */
26
-    public function matchesCurrentRequest(): bool
27
-    {
28
-        return parent::matchesCurrentRequest()
29
-               && $this->admin_config->useAdvancedEditor()
30
-               && (
31
-                   $this->request->getRequestParam('action') === 'create_new'
32
-                || $this->request->getRequestParam('action') === 'edit'
33
-               );
34
-    }
20
+	/**
21
+	 * returns true if the current request matches this route
22
+	 *
23
+	 * @return bool
24
+	 * @since   $VID:$
25
+	 */
26
+	public function matchesCurrentRequest(): bool
27
+	{
28
+		return parent::matchesCurrentRequest()
29
+			   && $this->admin_config->useAdvancedEditor()
30
+			   && (
31
+				   $this->request->getRequestParam('action') === 'create_new'
32
+				|| $this->request->getRequestParam('action') === 'edit'
33
+			   );
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * @since $VID:$
39
-     */
40
-    protected function registerDependencies()
41
-    {
42
-        $editor_dependencies = [
43
-            'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => [
44
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes'                 => EE_Dependency_Map::load_from_cache,
45
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Event'                     => EE_Dependency_Map::load_from_cache,
46
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Prices'                    => EE_Dependency_Map::load_from_cache,
47
-                'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes'                => EE_Dependency_Map::load_from_cache,
48
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets'                   => EE_Dependency_Map::load_from_cache,
49
-                'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache,
50
-                '\EventEspresso\core\domain\services\admin\events\editor\EventManagerData'       => EE_Dependency_Map::load_from_cache,
51
-                'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations'    => EE_Dependency_Map::load_from_cache,
52
-                'EventEspresso\core\domain\services\admin\events\editor\TicketMeta'              => EE_Dependency_Map::load_from_cache,
53
-                'EventEspresso\core\domain\services\admin\events\editor\FormBuilder'             => EE_Dependency_Map::load_from_cache,
54
-                'EventEspresso\core\domain\entities\admin\GraphQLData\Venues'                   => EE_Dependency_Map::load_from_cache,
55
-            ],
56
-            'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => [
57
-                'EEM_Datetime'                                         => EE_Dependency_Map::load_from_cache,
58
-                'EEM_Event'                                            => EE_Dependency_Map::load_from_cache,
59
-                'EEM_Price'                                            => EE_Dependency_Map::load_from_cache,
60
-                'EEM_Price_Type'                                       => EE_Dependency_Map::load_from_cache,
61
-                'EEM_Ticket'                                           => EE_Dependency_Map::load_from_cache,
62
-                'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache,
63
-            ],
64
-            'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => [
65
-                'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes'    => EE_Dependency_Map::load_from_cache,
66
-                'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => EE_Dependency_Map::load_from_cache,
67
-                'EEM_Datetime'                                                          => EE_Dependency_Map::load_from_cache,
68
-                'EEM_Event'                                                             => EE_Dependency_Map::load_from_cache,
69
-                'EEM_Price'                                                             => EE_Dependency_Map::load_from_cache,
70
-                'EEM_Price_Type'                                                        => EE_Dependency_Map::load_from_cache,
71
-                'EEM_Ticket'                                                            => EE_Dependency_Map::load_from_cache,
72
-                'EventEspresso\core\domain\services\graphql\Utilities'                  => EE_Dependency_Map::load_from_cache,
73
-            ],
74
-            'EventEspresso\core\domain\services\admin\events\editor\TicketMeta' => [
75
-                'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
76
-            ],
77
-            'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => [
78
-                'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache,
79
-                'EEM_Datetime'                                                     => EE_Dependency_Map::load_from_cache,
80
-            ],
81
-            'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => [
82
-                'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache,
83
-                'EEM_Ticket'                                                      => EE_Dependency_Map::load_from_cache,
84
-            ],
85
-            'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => [
86
-                'EEM_Price'      => EE_Dependency_Map::load_from_cache,
87
-                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
88
-            ],
89
-            'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => [
90
-                'EEM_Form_Element' => EE_Dependency_Map::load_from_cache,
91
-                'EEM_Form_Section' => EE_Dependency_Map::load_from_cache,
92
-            ],
93
-            'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' => [
94
-                'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache,
95
-                'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
96
-            ],
97
-            'EventEspresso\core\domain\services\assets\EventEditorAssetManager' => [
98
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
99
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
100
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
101
-            ],
102
-            'EventEspresso\core\domain\services\admin\events\editor\EventManagerData' => [
103
-                'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,
104
-                'EventEspresso\core\domain\services\graphql\Utilities'   => EE_Dependency_Map::load_from_cache,
105
-            ],
106
-        ];
107
-        foreach ($editor_dependencies as $dependency => $dependencies) {
108
-            $this->dependency_map->registerDependencies($dependency, $dependencies);
109
-        }
110
-    }
37
+	/**
38
+	 * @since $VID:$
39
+	 */
40
+	protected function registerDependencies()
41
+	{
42
+		$editor_dependencies = [
43
+			'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => [
44
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes'                 => EE_Dependency_Map::load_from_cache,
45
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Event'                     => EE_Dependency_Map::load_from_cache,
46
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Prices'                    => EE_Dependency_Map::load_from_cache,
47
+				'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes'                => EE_Dependency_Map::load_from_cache,
48
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets'                   => EE_Dependency_Map::load_from_cache,
49
+				'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache,
50
+				'\EventEspresso\core\domain\services\admin\events\editor\EventManagerData'       => EE_Dependency_Map::load_from_cache,
51
+				'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations'    => EE_Dependency_Map::load_from_cache,
52
+				'EventEspresso\core\domain\services\admin\events\editor\TicketMeta'              => EE_Dependency_Map::load_from_cache,
53
+				'EventEspresso\core\domain\services\admin\events\editor\FormBuilder'             => EE_Dependency_Map::load_from_cache,
54
+				'EventEspresso\core\domain\entities\admin\GraphQLData\Venues'                   => EE_Dependency_Map::load_from_cache,
55
+			],
56
+			'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => [
57
+				'EEM_Datetime'                                         => EE_Dependency_Map::load_from_cache,
58
+				'EEM_Event'                                            => EE_Dependency_Map::load_from_cache,
59
+				'EEM_Price'                                            => EE_Dependency_Map::load_from_cache,
60
+				'EEM_Price_Type'                                       => EE_Dependency_Map::load_from_cache,
61
+				'EEM_Ticket'                                           => EE_Dependency_Map::load_from_cache,
62
+				'EventEspresso\core\domain\services\graphql\Utilities' => EE_Dependency_Map::load_from_cache,
63
+			],
64
+			'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => [
65
+				'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes'    => EE_Dependency_Map::load_from_cache,
66
+				'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => EE_Dependency_Map::load_from_cache,
67
+				'EEM_Datetime'                                                          => EE_Dependency_Map::load_from_cache,
68
+				'EEM_Event'                                                             => EE_Dependency_Map::load_from_cache,
69
+				'EEM_Price'                                                             => EE_Dependency_Map::load_from_cache,
70
+				'EEM_Price_Type'                                                        => EE_Dependency_Map::load_from_cache,
71
+				'EEM_Ticket'                                                            => EE_Dependency_Map::load_from_cache,
72
+				'EventEspresso\core\domain\services\graphql\Utilities'                  => EE_Dependency_Map::load_from_cache,
73
+			],
74
+			'EventEspresso\core\domain\services\admin\events\editor\TicketMeta' => [
75
+				'EEM_Ticket' => EE_Dependency_Map::load_from_cache,
76
+			],
77
+			'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => [
78
+				'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache,
79
+				'EEM_Datetime'                                                     => EE_Dependency_Map::load_from_cache,
80
+			],
81
+			'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => [
82
+				'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache,
83
+				'EEM_Ticket'                                                      => EE_Dependency_Map::load_from_cache,
84
+			],
85
+			'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => [
86
+				'EEM_Price'      => EE_Dependency_Map::load_from_cache,
87
+				'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
88
+			],
89
+			'EventEspresso\core\domain\services\admin\entities\DefaultFormSections' => [
90
+				'EEM_Form_Element' => EE_Dependency_Map::load_from_cache,
91
+				'EEM_Form_Section' => EE_Dependency_Map::load_from_cache,
92
+			],
93
+			'EventEspresso\core\domain\entities\routing\data_nodes\domains\EventEditor' => [
94
+				'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => EE_Dependency_Map::load_from_cache,
95
+				'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
96
+			],
97
+			'EventEspresso\core\domain\services\assets\EventEditorAssetManager' => [
98
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
99
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
100
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
101
+			],
102
+			'EventEspresso\core\domain\services\admin\events\editor\EventManagerData' => [
103
+				'EventEspresso\core\domain\entities\users\EventManagers' => EE_Dependency_Map::load_from_cache,
104
+				'EventEspresso\core\domain\services\graphql\Utilities'   => EE_Dependency_Map::load_from_cache,
105
+			],
106
+		];
107
+		foreach ($editor_dependencies as $dependency => $dependencies) {
108
+			$this->dependency_map->registerDependencies($dependency, $dependencies);
109
+		}
110
+	}
111 111
 
112 112
 
113
-    /**
114
-     * @return string
115
-     */
116
-    protected function dataNodeClass(): string
117
-    {
118
-        return EventEditor::class;
119
-    }
113
+	/**
114
+	 * @return string
115
+	 */
116
+	protected function dataNodeClass(): string
117
+	{
118
+		return EventEditor::class;
119
+	}
120 120
 
121 121
 
122
-    /**
123
-     * implements logic required to run during request
124
-     *
125
-     * @return bool
126
-     * @since   $VID:$
127
-     */
128
-    protected function requestHandler(): bool
129
-    {
130
-        if (! class_exists('WPGraphQL')) {
131
-            require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
132
-        }
133
-        /** @var GraphQLManager $graphQL_manager */
134
-        $graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager');
135
-        $graphQL_manager->init();
122
+	/**
123
+	 * implements logic required to run during request
124
+	 *
125
+	 * @return bool
126
+	 * @since   $VID:$
127
+	 */
128
+	protected function requestHandler(): bool
129
+	{
130
+		if (! class_exists('WPGraphQL')) {
131
+			require_once EE_THIRD_PARTY . 'wp-graphql/wp-graphql.php';
132
+		}
133
+		/** @var GraphQLManager $graphQL_manager */
134
+		$graphQL_manager = $this->loader->getShared('EventEspresso\core\services\graphql\GraphQLManager');
135
+		$graphQL_manager->init();
136 136
 
137
-        /** @var EventEditorAssetManager $asset_manager */
138
-        $asset_manager = $this->loader->getShared(
139
-            'EventEspresso\core\domain\services\assets\EventEditorAssetManager'
140
-        );
141
-        add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']);
142
-        return true;
143
-    }
137
+		/** @var EventEditorAssetManager $asset_manager */
138
+		$asset_manager = $this->loader->getShared(
139
+			'EventEspresso\core\domain\services\assets\EventEditorAssetManager'
140
+		);
141
+		add_action('admin_enqueue_scripts', [$asset_manager, 'enqueueEventEditor']);
142
+		return true;
143
+	}
144 144
 }
Please login to merge, or discard this patch.