Completed
Branch prep-gql-for-better-local-cach... (8553e9)
by
unknown
36:50 queued 27:35
created
core/domain/services/graphql/connections/DatetimeTicketsConnection.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -20,131 +20,131 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * DatetimeConnection constructor.
25
-     *
26
-     * @param EEM_Ticket $model
27
-     */
28
-    public function __construct(EEM_Ticket $model)
29
-    {
30
-        $this->model = $model;
31
-    }
23
+	/**
24
+	 * DatetimeConnection constructor.
25
+	 *
26
+	 * @param EEM_Ticket $model
27
+	 */
28
+	public function __construct(EEM_Ticket $model)
29
+	{
30
+		$this->model = $model;
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * @return array
36
-     * @since $VID:$
37
-     */
38
-    public function config()
39
-    {
40
-        return [
41
-            'fromType'           => $this->namespace . 'Datetime',
42
-            'toType'             => $this->namespace . 'Ticket',
43
-            'fromFieldName'      => 'tickets',
44
-            'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection",
45
-            'connectionArgs'     => self::get_connection_args(),
46
-            'resolve'            => [$this, 'resolveConnection'],
47
-        ];
48
-    }
34
+	/**
35
+	 * @return array
36
+	 * @since $VID:$
37
+	 */
38
+	public function config()
39
+	{
40
+		return [
41
+			'fromType'           => $this->namespace . 'Datetime',
42
+			'toType'             => $this->namespace . 'Ticket',
43
+			'fromFieldName'      => 'tickets',
44
+			'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection",
45
+			'connectionArgs'     => self::get_connection_args(),
46
+			'resolve'            => [$this, 'resolveConnection'],
47
+		];
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * @param $entity
53
-     * @param $args
54
-     * @param $context
55
-     * @param $info
56
-     * @return array
57
-     * @throws Exception
58
-     * @since $VID:$
59
-     */
60
-    public function resolveConnection($entity, $args, $context, $info)
61
-    {
62
-        $resolver = new TicketConnectionResolver($entity, $args, $context, $info);
63
-        return $resolver->get_connection();
64
-    }
51
+	/**
52
+	 * @param $entity
53
+	 * @param $args
54
+	 * @param $context
55
+	 * @param $info
56
+	 * @return array
57
+	 * @throws Exception
58
+	 * @since $VID:$
59
+	 */
60
+	public function resolveConnection($entity, $args, $context, $info)
61
+	{
62
+		$resolver = new TicketConnectionResolver($entity, $args, $context, $info);
63
+		return $resolver->get_connection();
64
+	}
65 65
 
66
-    /**
67
-     * Given an optional array of args, this returns the args to be used in the connection
68
-     *
69
-     * @access public
70
-     * @param array $args The args to modify the defaults
71
-     *
72
-     * @return array
73
-     */
74
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
75
-    public static function get_connection_args($args = [])
76
-    {
77
-        $newArgs = [
78
-            'orderby'      => [
79
-                'type'        => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'],
80
-                'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
81
-            ],
82
-            'datetime' => [
83
-                'type'        => 'ID',
84
-                'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'),
85
-            ],
86
-            'datetimeIn' => [
87
-                'type'        => ['list_of' => 'ID'],
88
-                'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'),
89
-            ],
90
-            'datetimeId' => [
91
-                'type'        => 'Int',
92
-                'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'),
93
-            ],
94
-            'datetimeIdIn' => [
95
-                'type'        => ['list_of' => 'Int'],
96
-                'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'),
97
-            ],
98
-            'event'  => [
99
-                'type'        => 'ID',
100
-                'description' => esc_html__('Globally unique event ID to get the tickets for.', 'event_espresso'),
101
-            ],
102
-            'eventIn'  => [
103
-                'type'        => ['list_of' => 'ID'],
104
-                'description' => esc_html__('Globally unique event IDs to get the tickets for.', 'event_espresso'),
105
-            ],
106
-            'eventId'  => [
107
-                'type'        => 'Int',
108
-                'description' => esc_html__('Event ID to get the tickets for.', 'event_espresso'),
109
-            ],
110
-            'eventIdIn'  => [
111
-                'type'        => ['list_of' => 'Int'],
112
-                'description' => esc_html__('Event IDs to get the tickets for.', 'event_espresso'),
113
-            ],
114
-            'includeDefaultTickets'  => [
115
-                'type'        => 'Boolean',
116
-                'description' => esc_html__('Whether to add default tickets to the list.', 'event_espresso'),
117
-            ],
118
-            'search' => [
119
-                'type'        => 'String',
120
-                'description' => esc_html__('The search keywords', 'event_espresso'),
121
-            ],
122
-            'isDefault' => [
123
-                'type'        => 'Boolean',
124
-                'description' => esc_html__('Filter the default tickets', 'event_espresso'),
125
-            ],
126
-            'isRequired'   => [
127
-                'type'        => 'Boolean',
128
-                'description' => esc_html__('Filter the required tickets', 'event_espresso'),
129
-            ],
130
-            'isTaxable'   => [
131
-                'type'        => 'Boolean',
132
-                'description' => esc_html__('Filter the taxable tickets', 'event_espresso'),
133
-            ],
134
-            'isTrashed'   => [
135
-                'type'        => 'Boolean',
136
-                'description' => esc_html__('Filter the trashed tickets', 'event_espresso'),
137
-            ],
138
-        ];
66
+	/**
67
+	 * Given an optional array of args, this returns the args to be used in the connection
68
+	 *
69
+	 * @access public
70
+	 * @param array $args The args to modify the defaults
71
+	 *
72
+	 * @return array
73
+	 */
74
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
75
+	public static function get_connection_args($args = [])
76
+	{
77
+		$newArgs = [
78
+			'orderby'      => [
79
+				'type'        => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'],
80
+				'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
81
+			],
82
+			'datetime' => [
83
+				'type'        => 'ID',
84
+				'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'),
85
+			],
86
+			'datetimeIn' => [
87
+				'type'        => ['list_of' => 'ID'],
88
+				'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'),
89
+			],
90
+			'datetimeId' => [
91
+				'type'        => 'Int',
92
+				'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'),
93
+			],
94
+			'datetimeIdIn' => [
95
+				'type'        => ['list_of' => 'Int'],
96
+				'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'),
97
+			],
98
+			'event'  => [
99
+				'type'        => 'ID',
100
+				'description' => esc_html__('Globally unique event ID to get the tickets for.', 'event_espresso'),
101
+			],
102
+			'eventIn'  => [
103
+				'type'        => ['list_of' => 'ID'],
104
+				'description' => esc_html__('Globally unique event IDs to get the tickets for.', 'event_espresso'),
105
+			],
106
+			'eventId'  => [
107
+				'type'        => 'Int',
108
+				'description' => esc_html__('Event ID to get the tickets for.', 'event_espresso'),
109
+			],
110
+			'eventIdIn'  => [
111
+				'type'        => ['list_of' => 'Int'],
112
+				'description' => esc_html__('Event IDs to get the tickets for.', 'event_espresso'),
113
+			],
114
+			'includeDefaultTickets'  => [
115
+				'type'        => 'Boolean',
116
+				'description' => esc_html__('Whether to add default tickets to the list.', 'event_espresso'),
117
+			],
118
+			'search' => [
119
+				'type'        => 'String',
120
+				'description' => esc_html__('The search keywords', 'event_espresso'),
121
+			],
122
+			'isDefault' => [
123
+				'type'        => 'Boolean',
124
+				'description' => esc_html__('Filter the default tickets', 'event_espresso'),
125
+			],
126
+			'isRequired'   => [
127
+				'type'        => 'Boolean',
128
+				'description' => esc_html__('Filter the required tickets', 'event_espresso'),
129
+			],
130
+			'isTaxable'   => [
131
+				'type'        => 'Boolean',
132
+				'description' => esc_html__('Filter the taxable tickets', 'event_espresso'),
133
+			],
134
+			'isTrashed'   => [
135
+				'type'        => 'Boolean',
136
+				'description' => esc_html__('Filter the trashed tickets', 'event_espresso'),
137
+			],
138
+		];
139 139
 
140
-        $newArgs = apply_filters(
141
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args',
142
-            $newArgs,
143
-            $args
144
-        );
145
-        return array_merge(
146
-            $newArgs,
147
-            $args
148
-        );
149
-    }
140
+		$newArgs = apply_filters(
141
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args',
142
+			$newArgs,
143
+			$args
144
+		);
145
+		return array_merge(
146
+			$newArgs,
147
+			$args
148
+		);
149
+	}
150 150
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/TicketPricesConnection.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -19,139 +19,139 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * TicketConnection constructor.
24
-     *
25
-     * @param EEM_Price $model
26
-     */
27
-    public function __construct(EEM_Price $model)
28
-    {
29
-        $this->model = $model;
30
-    }
22
+	/**
23
+	 * TicketConnection constructor.
24
+	 *
25
+	 * @param EEM_Price $model
26
+	 */
27
+	public function __construct(EEM_Price $model)
28
+	{
29
+		$this->model = $model;
30
+	}
31 31
 
32 32
 
33
-    /**
34
-     * @return array
35
-     * @since $VID:$
36
-     */
37
-    public function config()
38
-    {
39
-        return [
40
-            'fromType'           => $this->namespace . 'Ticket',
41
-            'toType'             => $this->namespace . 'Price',
42
-            'fromFieldName'      => 'prices',
43
-            'connectionTypeName' => "{$this->namespace}TicketPricesConnection",
44
-            'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45
-            'resolve'            => [$this, 'resolveConnection'],
46
-        ];
47
-    }
33
+	/**
34
+	 * @return array
35
+	 * @since $VID:$
36
+	 */
37
+	public function config()
38
+	{
39
+		return [
40
+			'fromType'           => $this->namespace . 'Ticket',
41
+			'toType'             => $this->namespace . 'Price',
42
+			'fromFieldName'      => 'prices',
43
+			'connectionTypeName' => "{$this->namespace}TicketPricesConnection",
44
+			'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45
+			'resolve'            => [$this, 'resolveConnection'],
46
+		];
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @param $entity
52
-     * @param $args
53
-     * @param $context
54
-     * @param $info
55
-     * @return array
56
-     * @throws Exception
57
-     * @since $VID:$
58
-     */
59
-    public function resolveConnection($entity, $args, $context, $info)
60
-    {
61
-        $resolver = new PriceConnectionResolver($entity, $args, $context, $info);
62
-        return $resolver->get_connection();
63
-    }
50
+	/**
51
+	 * @param $entity
52
+	 * @param $args
53
+	 * @param $context
54
+	 * @param $info
55
+	 * @return array
56
+	 * @throws Exception
57
+	 * @since $VID:$
58
+	 */
59
+	public function resolveConnection($entity, $args, $context, $info)
60
+	{
61
+		$resolver = new PriceConnectionResolver($entity, $args, $context, $info);
62
+		return $resolver->get_connection();
63
+	}
64 64
 
65
-    /**
66
-     * Given an optional array of args, this returns the args to be used in the connection
67
-     *
68
-     * @access public
69
-     * @param array $args The args to modify the defaults
70
-     *
71
-     * @return array
72
-     */
73
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
74
-    public static function get_connection_args($args = [])
75
-    {
76
-        $newArgs = [
77
-            'in'              => [
78
-                'type'        => ['list_of' => 'ID'],
79
-                'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'),
80
-            ],
81
-            'idIn'            => [
82
-                'type'        => ['list_of' => 'ID'],
83
-                'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'),
84
-            ],
85
-            'event'  => [
86
-                'type'        => 'ID',
87
-                'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'),
88
-            ],
89
-            'eventId'  => [
90
-                'type'        => 'Int',
91
-                'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'),
92
-            ],
93
-            'includeDefaultPrices'  => [
94
-                'type'        => 'Boolean',
95
-                'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'),
96
-            ],
97
-            'includeDefaultTicketsPrices'  => [
98
-                'type'        => 'Boolean',
99
-                'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'),
100
-            ],
101
-            'isDefault' => [
102
-                'type'        => 'Boolean',
103
-                'description' => esc_html__('Filter the default prices', 'event_espresso'),
104
-            ],
105
-            'ticket'          => [
106
-                'type'        => 'ID',
107
-                'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'),
108
-            ],
109
-            'ticketIn'        => [
110
-                'type'        => ['list_of' => 'ID'],
111
-                'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'),
112
-            ],
113
-            'ticketId'        => [
114
-                'type'        => 'Int',
115
-                'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'),
116
-            ],
117
-            'ticketIdIn'      => [
118
-                'type'        => ['list_of' => 'Int'],
119
-                'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'),
120
-            ],
121
-            'priceType'       => [
122
-                'type'        => 'ID',
123
-                'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'),
124
-            ],
125
-            'priceTypeIn'     => [
126
-                'type'        => ['list_of' => 'ID'],
127
-                'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'),
128
-            ],
129
-            'priceTypeId'     => [
130
-                'type'        => 'Int',
131
-                'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'),
132
-            ],
133
-            'priceTypeIdIn'   => [
134
-                'type'        => ['list_of' => 'Int'],
135
-                'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'),
136
-            ],
137
-            'priceBaseType'   => [
138
-                'type'        => 'PriceBaseTypeEnum',
139
-                'description' => esc_html__('Price Base type.', 'event_espresso'),
140
-            ],
141
-            'priceBaseTypeIn' => [
142
-                'type'        => ['list_of' => 'PriceBaseTypeEnum'],
143
-                'description' => esc_html__('Price Base types.', 'event_espresso'),
144
-            ],
145
-        ];
65
+	/**
66
+	 * Given an optional array of args, this returns the args to be used in the connection
67
+	 *
68
+	 * @access public
69
+	 * @param array $args The args to modify the defaults
70
+	 *
71
+	 * @return array
72
+	 */
73
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
74
+	public static function get_connection_args($args = [])
75
+	{
76
+		$newArgs = [
77
+			'in'              => [
78
+				'type'        => ['list_of' => 'ID'],
79
+				'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'),
80
+			],
81
+			'idIn'            => [
82
+				'type'        => ['list_of' => 'ID'],
83
+				'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'),
84
+			],
85
+			'event'  => [
86
+				'type'        => 'ID',
87
+				'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'),
88
+			],
89
+			'eventId'  => [
90
+				'type'        => 'Int',
91
+				'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'),
92
+			],
93
+			'includeDefaultPrices'  => [
94
+				'type'        => 'Boolean',
95
+				'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'),
96
+			],
97
+			'includeDefaultTicketsPrices'  => [
98
+				'type'        => 'Boolean',
99
+				'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'),
100
+			],
101
+			'isDefault' => [
102
+				'type'        => 'Boolean',
103
+				'description' => esc_html__('Filter the default prices', 'event_espresso'),
104
+			],
105
+			'ticket'          => [
106
+				'type'        => 'ID',
107
+				'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'),
108
+			],
109
+			'ticketIn'        => [
110
+				'type'        => ['list_of' => 'ID'],
111
+				'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'),
112
+			],
113
+			'ticketId'        => [
114
+				'type'        => 'Int',
115
+				'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'),
116
+			],
117
+			'ticketIdIn'      => [
118
+				'type'        => ['list_of' => 'Int'],
119
+				'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'),
120
+			],
121
+			'priceType'       => [
122
+				'type'        => 'ID',
123
+				'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'),
124
+			],
125
+			'priceTypeIn'     => [
126
+				'type'        => ['list_of' => 'ID'],
127
+				'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'),
128
+			],
129
+			'priceTypeId'     => [
130
+				'type'        => 'Int',
131
+				'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'),
132
+			],
133
+			'priceTypeIdIn'   => [
134
+				'type'        => ['list_of' => 'Int'],
135
+				'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'),
136
+			],
137
+			'priceBaseType'   => [
138
+				'type'        => 'PriceBaseTypeEnum',
139
+				'description' => esc_html__('Price Base type.', 'event_espresso'),
140
+			],
141
+			'priceBaseTypeIn' => [
142
+				'type'        => ['list_of' => 'PriceBaseTypeEnum'],
143
+				'description' => esc_html__('Price Base types.', 'event_espresso'),
144
+			],
145
+		];
146 146
 
147
-        $newArgs = apply_filters(
148
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args',
149
-            $newArgs,
150
-            $args
151
-        );
152
-        return array_merge(
153
-            $newArgs,
154
-            $args
155
-        );
156
-    }
147
+		$newArgs = apply_filters(
148
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args',
149
+			$newArgs,
150
+			$args
151
+		);
152
+		return array_merge(
153
+			$newArgs,
154
+			$args
155
+		);
156
+	}
157 157
 }
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/PriceConnectionResolver.php 2 patches
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -17,218 +17,218 @@
 block discarded – undo
17 17
  */
18 18
 class PriceConnectionResolver extends AbstractConnectionResolver
19 19
 {
20
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
21
-    public function get_loader_name()
22
-    {
23
-        return 'espresso_price';
24
-    }
25
-
26
-    /**
27
-     * @return EEM_Price
28
-     * @throws EE_Error
29
-     * @throws InvalidArgumentException
30
-     * @throws InvalidDataTypeException
31
-     * @throws InvalidInterfaceException
32
-     */
33
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
34
-    public function get_query()
35
-    {
36
-        return EEM_Price::instance();
37
-    }
38
-
39
-
40
-    /**
41
-     * Return an array of item IDs from the query
42
-     *
43
-     * @return array
44
-     */
45
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
46
-    public function get_ids()
47
-    {
48
-        $results = $this->query->get_col($this->query_args);
49
-
50
-        return ! empty($results) ? $results : [];
51
-    }
52
-
53
-
54
-    /**
55
-     * Here, we map the args from the input, then we make sure that we're only querying
56
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
57
-     * handle batch resolution of the posts.
58
-     *
59
-     * @return array
60
-     * @throws EE_Error
61
-     * @throws InvalidArgumentException
62
-     * @throws ReflectionException
63
-     * @throws InvalidDataTypeException
64
-     * @throws InvalidInterfaceException
65
-     */
66
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
67
-    public function get_query_args()
68
-    {
69
-        $where_params = [];
70
-        $query_args   = [];
71
-
72
-        $query_args['limit'] = $this->getLimit();
73
-
74
-        // Avoid multiple entries by join.
75
-        $query_args['group_by'] = 'PRC_ID';
76
-
77
-        $query_args['default_where_conditions'] = 'minimum';
78
-
79
-        /**
80
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
81
-         */
82
-        $input_fields = [];
83
-        if (! empty($this->args['where'])) {
84
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
85
-
86
-            // Use the proper operator.
87
-            if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
88
-                $input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
89
-            }
90
-            if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
91
-                $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
92
-            }
93
-            if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
94
-                $input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
95
-            }
96
-            if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
97
-                $input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
98
-            }
99
-            // if event ID is passed but not a ticket ID
100
-            if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
101
-                $event_id = $input_fields['Event.EVT_ID'];
102
-                // Ensure that this doesn't go to the query.
103
-                // After all there is no DB relation between event and price
104
-                unset($input_fields['Event.EVT_ID']);
105
-                // get all the datetimeIds of the event
106
-                $event_datetime_ids = EEM_Datetime::instance()->get_col([
107
-                    [
108
-                        'EVT_ID'      => $event_id,
109
-                    ],
110
-                    'default_where_conditions' => 'minimum'
111
-                ]);
112
-                // get all the related ticket Ids
113
-                $ticket_ids = EEM_Ticket::instance()->get_col([
114
-                    [
115
-                        'Datetime.DTT_ID' => ['IN', $event_datetime_ids],
116
-                    ],
117
-                    'default_where_conditions' => 'minimum'
118
-                ]);
119
-
120
-                // add tickets relation to the query
121
-                $input_fields['Ticket.TKT_ID'] = ['IN', $ticket_ids];
122
-            }
123
-        }
124
-
125
-        /**
126
-         * Determine where we're at in the Graph and adjust the query context appropriately.
127
-         */
128
-        if ($this->source instanceof EE_Ticket) {
129
-            $where_params['Ticket.TKT_ID'] = $this->source->ID();
130
-        }
131
-
132
-        /**
133
-         * Merge the input_fields with the default query_args
134
-         */
135
-        if (! empty($input_fields)) {
136
-            $where_params = array_merge($where_params, $input_fields);
137
-        }
138
-
139
-        list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
140
-
141
-        $default_prices_params = [];
142
-
143
-        // If default ticket prices should be included.
144
-        if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
145
-            $default_ticket_ids = EEM_Ticket::instance()->get_col([
146
-                [
147
-                    'TKT_is_default' => 1,
148
-                ],
149
-                'default_where_conditions' => 'minimum'
150
-            ]);
151
-
152
-            // if we have default tickets
153
-            if (! empty($default_ticket_ids)) {
154
-                $default_prices_params['OR'] = [
155
-                    'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
156
-                ];
157
-            }
158
-        }
159
-
160
-        // If default prices should be included.
161
-        if (! empty($this->args['where']['includeDefaultPrices'])) {
162
-            $default_prices_params['AND'] = [
163
-                'PRC_deleted'    => 0,
164
-                'PRC_is_default' => 1,
165
-            ];
166
-        }
167
-
168
-        if (! empty($default_prices_params)) {
169
-            if (empty($where_params)) {
170
-                $where_params['OR'] = $default_prices_params;
171
-            } else {
172
-                $where_params = [
173
-                    'OR' => [
174
-                        'OR'  => $default_prices_params,
175
-                        'AND' => $where_params,
176
-                    ],
177
-                ];
178
-            }
179
-        }
180
-
181
-        $where_params = apply_filters(
182
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
183
-            $where_params,
184
-            $this->source,
185
-            $this->args
186
-        );
187
-
188
-        $query_args[] = $where_params;
189
-
190
-        /**
191
-         * Return the $query_args
192
-         */
193
-        return apply_filters(
194
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
195
-            $query_args,
196
-            $this->source,
197
-            $this->args
198
-        );
199
-    }
200
-
201
-
202
-    /**
203
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
204
-     * friendly keys.
205
-     *
206
-     * @param array $where_args
207
-     * @return array
208
-     */
209
-    public function sanitizeInputFields(array $where_args)
210
-    {
211
-        $arg_mapping = [
212
-            'in'              => 'PRC_ID',
213
-            'idIn'            => 'PRC_ID',
214
-            'isDefault'       => 'PRC_is_default',
215
-            'event'           => 'Event.EVT_ID',
216
-            'eventId'         => 'Event.EVT_ID', // priority.
217
-            'ticket'          => 'Ticket.TKT_ID',
218
-            'ticketIn'        => 'Ticket.TKT_ID',
219
-            'ticketIdIn'      => 'Ticket.TKT_ID',
220
-            'ticketId'        => 'Ticket.TKT_ID', // priority.
221
-            'priceType'       => 'Price_Type.PRT_ID',
222
-            'priceTypeIn'     => 'Price_Type.PRT_ID',
223
-            'priceTypeIdIn'   => 'Price_Type.PRT_ID',
224
-            'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
225
-            'priceBaseType'   => 'Price_Type.PBT_ID',
226
-            'priceBaseTypeIn' => 'Price_Type.PBT_ID',
227
-        ];
228
-        return $this->sanitizeWhereArgsForInputFields(
229
-            $where_args,
230
-            $arg_mapping,
231
-            ['in', 'event', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
232
-        );
233
-    }
20
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
21
+	public function get_loader_name()
22
+	{
23
+		return 'espresso_price';
24
+	}
25
+
26
+	/**
27
+	 * @return EEM_Price
28
+	 * @throws EE_Error
29
+	 * @throws InvalidArgumentException
30
+	 * @throws InvalidDataTypeException
31
+	 * @throws InvalidInterfaceException
32
+	 */
33
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
34
+	public function get_query()
35
+	{
36
+		return EEM_Price::instance();
37
+	}
38
+
39
+
40
+	/**
41
+	 * Return an array of item IDs from the query
42
+	 *
43
+	 * @return array
44
+	 */
45
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
46
+	public function get_ids()
47
+	{
48
+		$results = $this->query->get_col($this->query_args);
49
+
50
+		return ! empty($results) ? $results : [];
51
+	}
52
+
53
+
54
+	/**
55
+	 * Here, we map the args from the input, then we make sure that we're only querying
56
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
57
+	 * handle batch resolution of the posts.
58
+	 *
59
+	 * @return array
60
+	 * @throws EE_Error
61
+	 * @throws InvalidArgumentException
62
+	 * @throws ReflectionException
63
+	 * @throws InvalidDataTypeException
64
+	 * @throws InvalidInterfaceException
65
+	 */
66
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
67
+	public function get_query_args()
68
+	{
69
+		$where_params = [];
70
+		$query_args   = [];
71
+
72
+		$query_args['limit'] = $this->getLimit();
73
+
74
+		// Avoid multiple entries by join.
75
+		$query_args['group_by'] = 'PRC_ID';
76
+
77
+		$query_args['default_where_conditions'] = 'minimum';
78
+
79
+		/**
80
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
81
+		 */
82
+		$input_fields = [];
83
+		if (! empty($this->args['where'])) {
84
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
85
+
86
+			// Use the proper operator.
87
+			if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
88
+				$input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
89
+			}
90
+			if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
91
+				$input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
92
+			}
93
+			if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
94
+				$input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
95
+			}
96
+			if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
97
+				$input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
98
+			}
99
+			// if event ID is passed but not a ticket ID
100
+			if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
101
+				$event_id = $input_fields['Event.EVT_ID'];
102
+				// Ensure that this doesn't go to the query.
103
+				// After all there is no DB relation between event and price
104
+				unset($input_fields['Event.EVT_ID']);
105
+				// get all the datetimeIds of the event
106
+				$event_datetime_ids = EEM_Datetime::instance()->get_col([
107
+					[
108
+						'EVT_ID'      => $event_id,
109
+					],
110
+					'default_where_conditions' => 'minimum'
111
+				]);
112
+				// get all the related ticket Ids
113
+				$ticket_ids = EEM_Ticket::instance()->get_col([
114
+					[
115
+						'Datetime.DTT_ID' => ['IN', $event_datetime_ids],
116
+					],
117
+					'default_where_conditions' => 'minimum'
118
+				]);
119
+
120
+				// add tickets relation to the query
121
+				$input_fields['Ticket.TKT_ID'] = ['IN', $ticket_ids];
122
+			}
123
+		}
124
+
125
+		/**
126
+		 * Determine where we're at in the Graph and adjust the query context appropriately.
127
+		 */
128
+		if ($this->source instanceof EE_Ticket) {
129
+			$where_params['Ticket.TKT_ID'] = $this->source->ID();
130
+		}
131
+
132
+		/**
133
+		 * Merge the input_fields with the default query_args
134
+		 */
135
+		if (! empty($input_fields)) {
136
+			$where_params = array_merge($where_params, $input_fields);
137
+		}
138
+
139
+		list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
140
+
141
+		$default_prices_params = [];
142
+
143
+		// If default ticket prices should be included.
144
+		if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
145
+			$default_ticket_ids = EEM_Ticket::instance()->get_col([
146
+				[
147
+					'TKT_is_default' => 1,
148
+				],
149
+				'default_where_conditions' => 'minimum'
150
+			]);
151
+
152
+			// if we have default tickets
153
+			if (! empty($default_ticket_ids)) {
154
+				$default_prices_params['OR'] = [
155
+					'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
156
+				];
157
+			}
158
+		}
159
+
160
+		// If default prices should be included.
161
+		if (! empty($this->args['where']['includeDefaultPrices'])) {
162
+			$default_prices_params['AND'] = [
163
+				'PRC_deleted'    => 0,
164
+				'PRC_is_default' => 1,
165
+			];
166
+		}
167
+
168
+		if (! empty($default_prices_params)) {
169
+			if (empty($where_params)) {
170
+				$where_params['OR'] = $default_prices_params;
171
+			} else {
172
+				$where_params = [
173
+					'OR' => [
174
+						'OR'  => $default_prices_params,
175
+						'AND' => $where_params,
176
+					],
177
+				];
178
+			}
179
+		}
180
+
181
+		$where_params = apply_filters(
182
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
183
+			$where_params,
184
+			$this->source,
185
+			$this->args
186
+		);
187
+
188
+		$query_args[] = $where_params;
189
+
190
+		/**
191
+		 * Return the $query_args
192
+		 */
193
+		return apply_filters(
194
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
195
+			$query_args,
196
+			$this->source,
197
+			$this->args
198
+		);
199
+	}
200
+
201
+
202
+	/**
203
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
204
+	 * friendly keys.
205
+	 *
206
+	 * @param array $where_args
207
+	 * @return array
208
+	 */
209
+	public function sanitizeInputFields(array $where_args)
210
+	{
211
+		$arg_mapping = [
212
+			'in'              => 'PRC_ID',
213
+			'idIn'            => 'PRC_ID',
214
+			'isDefault'       => 'PRC_is_default',
215
+			'event'           => 'Event.EVT_ID',
216
+			'eventId'         => 'Event.EVT_ID', // priority.
217
+			'ticket'          => 'Ticket.TKT_ID',
218
+			'ticketIn'        => 'Ticket.TKT_ID',
219
+			'ticketIdIn'      => 'Ticket.TKT_ID',
220
+			'ticketId'        => 'Ticket.TKT_ID', // priority.
221
+			'priceType'       => 'Price_Type.PRT_ID',
222
+			'priceTypeIn'     => 'Price_Type.PRT_ID',
223
+			'priceTypeIdIn'   => 'Price_Type.PRT_ID',
224
+			'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
225
+			'priceBaseType'   => 'Price_Type.PBT_ID',
226
+			'priceBaseTypeIn' => 'Price_Type.PBT_ID',
227
+		];
228
+		return $this->sanitizeWhereArgsForInputFields(
229
+			$where_args,
230
+			$arg_mapping,
231
+			['in', 'event', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
232
+		);
233
+	}
234 234
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
          * Collect the input_fields and sanitize them to prepare them for sending to the Query
81 81
          */
82 82
         $input_fields = [];
83
-        if (! empty($this->args['where'])) {
83
+        if ( ! empty($this->args['where'])) {
84 84
             $input_fields = $this->sanitizeInputFields($this->args['where']);
85 85
 
86 86
             // Use the proper operator.
87
-            if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
87
+            if ( ! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
88 88
                 $input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
89 89
             }
90
-            if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
90
+            if ( ! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
91 91
                 $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
92 92
             }
93
-            if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
93
+            if ( ! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
94 94
                 $input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
95 95
             }
96
-            if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
96
+            if ( ! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
97 97
                 $input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
98 98
             }
99 99
             // if event ID is passed but not a ticket ID
100
-            if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
100
+            if ( ! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
101 101
                 $event_id = $input_fields['Event.EVT_ID'];
102 102
                 // Ensure that this doesn't go to the query.
103 103
                 // After all there is no DB relation between event and price
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         /**
133 133
          * Merge the input_fields with the default query_args
134 134
          */
135
-        if (! empty($input_fields)) {
135
+        if ( ! empty($input_fields)) {
136 136
             $where_params = array_merge($where_params, $input_fields);
137 137
         }
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $default_prices_params = [];
142 142
 
143 143
         // If default ticket prices should be included.
144
-        if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
144
+        if ( ! empty($this->args['where']['includeDefaultTicketsPrices'])) {
145 145
             $default_ticket_ids = EEM_Ticket::instance()->get_col([
146 146
                 [
147 147
                     'TKT_is_default' => 1,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             ]);
151 151
 
152 152
             // if we have default tickets
153
-            if (! empty($default_ticket_ids)) {
153
+            if ( ! empty($default_ticket_ids)) {
154 154
                 $default_prices_params['OR'] = [
155 155
                     'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
156 156
                 ];
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
         }
159 159
 
160 160
         // If default prices should be included.
161
-        if (! empty($this->args['where']['includeDefaultPrices'])) {
161
+        if ( ! empty($this->args['where']['includeDefaultPrices'])) {
162 162
             $default_prices_params['AND'] = [
163 163
                 'PRC_deleted'    => 0,
164 164
                 'PRC_is_default' => 1,
165 165
             ];
166 166
         }
167 167
 
168
-        if (! empty($default_prices_params)) {
168
+        if ( ! empty($default_prices_params)) {
169 169
             if (empty($where_params)) {
170 170
                 $where_params['OR'] = $default_prices_params;
171 171
             } else {
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/TicketConnectionResolver.php 2 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -15,177 +15,177 @@
 block discarded – undo
15 15
  */
16 16
 class TicketConnectionResolver extends AbstractConnectionResolver
17 17
 {
18
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
19
-    public function get_loader_name()
20
-    {
21
-        return 'espresso_ticket';
22
-    }
23
-
24
-    /**
25
-     * @return EEM_Ticket
26
-     * @throws EE_Error
27
-     * @throws InvalidArgumentException
28
-     * @throws InvalidDataTypeException
29
-     * @throws InvalidInterfaceException
30
-     */
31
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
32
-    public function get_query()
33
-    {
34
-        return EEM_Ticket::instance();
35
-    }
36
-
37
-
38
-    /**
39
-     * Return an array of item IDs from the query
40
-     *
41
-     * @return array
42
-     */
43
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
44
-    public function get_ids()
45
-    {
46
-        $results = $this->query->get_col($this->query_args);
47
-
48
-        return ! empty($results) ? $results : [];
49
-    }
50
-
51
-
52
-    /**
53
-     * Here, we map the args from the input, then we make sure that we're only querying
54
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
55
-     * handle batch resolution of the posts.
56
-     *
57
-     * @return array
58
-     * @throws EE_Error
59
-     * @throws InvalidArgumentException
60
-     * @throws ReflectionException
61
-     * @throws InvalidDataTypeException
62
-     * @throws InvalidInterfaceException
63
-     */
64
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
65
-    public function get_query_args()
66
-    {
67
-        $where_params = ['TKT_deleted' => ['IN', [true, false]]];
68
-        $query_args   = [];
69
-
70
-        $query_args['limit'] = $this->getLimit();
71
-
72
-        // Avoid multiple entries by join.
73
-        $query_args['group_by'] = 'TKT_ID';
74
-
75
-        $query_args['default_where_conditions'] = 'minimum';
76
-
77
-        /**
78
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
79
-         */
80
-        $input_fields = [];
81
-        if (! empty($this->args['where'])) {
82
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
83
-
84
-            // Use the proper operator.
85
-            if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
86
-                $input_fields['Datetime.DTT_ID'] = ['IN', $input_fields['Datetime.DTT_ID']];
87
-            }
88
-            if (! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
89
-                $input_fields['Datetime.EVT_ID'] = ['IN', $input_fields['Datetime.EVT_ID']];
90
-            }
91
-        }
92
-
93
-        /**
94
-         * Determine where we're at in the Graph and adjust the query context appropriately.
95
-         */
96
-        if ($this->source instanceof EE_Datetime) {
97
-            $where_params['Datetime.DTT_ID'] = $this->source->ID();
98
-        }
99
-
100
-        /**
101
-         * Merge the input_fields with the default query_args
102
-         */
103
-        if (! empty($input_fields)) {
104
-            $where_params = array_merge($where_params, $input_fields);
105
-        }
106
-
107
-        list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID');
108
-
109
-        $search = isset($this->args['where']) ? $this->getSearchKeywords($this->args['where']) : '';
110
-
111
-        if (! empty($search)) {
112
-            // use OR operator to search in any of the fields
113
-            $where_params['OR'] = array(
114
-                'TKT_name'        => array('LIKE', '%' . $search . '%'),
115
-                'TKT_description' => array('LIKE', '%' . $search . '%'),
116
-            );
117
-        }
118
-
119
-        // If default tickets should be included.
120
-        if (! empty($this->args['where']['includeDefaultTickets'])) {
121
-            /**
122
-             * We need to get each ticket that
123
-             * - satisfies $where_params above
124
-             * OR
125
-             * - it's a default ticket
126
-             */
127
-            $where_params = [
128
-                'OR' => [
129
-                    // use extra OR instead of AND to avoid it getting overridden
130
-                    'OR' => [
131
-                        'AND' => [
132
-                            'TKT_deleted'    => ['IN', [true, false]],
133
-                            'TKT_is_default' => 1,
134
-                        ]
135
-                    ],
136
-                    'AND' => $where_params,
137
-                ],
138
-            ];
139
-        }
140
-
141
-        $where_params = apply_filters(
142
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_where_params',
143
-            $where_params,
144
-            $this->source,
145
-            $this->args
146
-        );
147
-
148
-        $query_args[] = $where_params;
149
-
150
-        /**
151
-         * Return the $query_args
152
-         */
153
-        return apply_filters(
154
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_query_args',
155
-            $query_args,
156
-            $this->source,
157
-            $this->args
158
-        );
159
-    }
160
-
161
-
162
-    /**
163
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
164
-     * friendly keys.
165
-     *
166
-     * @param array $where_args
167
-     * @return array
168
-     */
169
-    public function sanitizeInputFields(array $where_args)
170
-    {
171
-        $arg_mapping = [
172
-            'event'        => 'Datetime.EVT_ID',
173
-            'eventIn'      => 'Datetime.EVT_ID',
174
-            'eventIdIn'    => 'Datetime.EVT_ID',
175
-            'eventId'      => 'Datetime.EVT_ID', // priority.
176
-            'datetime'     => 'Datetime.DTT_ID',
177
-            'datetimeIn'   => 'Datetime.DTT_ID',
178
-            'datetimeIdIn' => 'Datetime.DTT_ID',
179
-            'datetimeId'   => 'Datetime.DTT_ID', // priority.
180
-            'isDefault'    => 'TKT_is_default',
181
-            'isRequired'   => 'TKT_required',
182
-            'isTaxable'    => 'TKT_taxable',
183
-            'isTrashed'    => 'TKT_deleted',
184
-        ];
185
-        return $this->sanitizeWhereArgsForInputFields(
186
-            $where_args,
187
-            $arg_mapping,
188
-            ['datetime', 'datetimeIn', 'event', 'eventIn']
189
-        );
190
-    }
18
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
19
+	public function get_loader_name()
20
+	{
21
+		return 'espresso_ticket';
22
+	}
23
+
24
+	/**
25
+	 * @return EEM_Ticket
26
+	 * @throws EE_Error
27
+	 * @throws InvalidArgumentException
28
+	 * @throws InvalidDataTypeException
29
+	 * @throws InvalidInterfaceException
30
+	 */
31
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
32
+	public function get_query()
33
+	{
34
+		return EEM_Ticket::instance();
35
+	}
36
+
37
+
38
+	/**
39
+	 * Return an array of item IDs from the query
40
+	 *
41
+	 * @return array
42
+	 */
43
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
44
+	public function get_ids()
45
+	{
46
+		$results = $this->query->get_col($this->query_args);
47
+
48
+		return ! empty($results) ? $results : [];
49
+	}
50
+
51
+
52
+	/**
53
+	 * Here, we map the args from the input, then we make sure that we're only querying
54
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
55
+	 * handle batch resolution of the posts.
56
+	 *
57
+	 * @return array
58
+	 * @throws EE_Error
59
+	 * @throws InvalidArgumentException
60
+	 * @throws ReflectionException
61
+	 * @throws InvalidDataTypeException
62
+	 * @throws InvalidInterfaceException
63
+	 */
64
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
65
+	public function get_query_args()
66
+	{
67
+		$where_params = ['TKT_deleted' => ['IN', [true, false]]];
68
+		$query_args   = [];
69
+
70
+		$query_args['limit'] = $this->getLimit();
71
+
72
+		// Avoid multiple entries by join.
73
+		$query_args['group_by'] = 'TKT_ID';
74
+
75
+		$query_args['default_where_conditions'] = 'minimum';
76
+
77
+		/**
78
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
79
+		 */
80
+		$input_fields = [];
81
+		if (! empty($this->args['where'])) {
82
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
83
+
84
+			// Use the proper operator.
85
+			if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
86
+				$input_fields['Datetime.DTT_ID'] = ['IN', $input_fields['Datetime.DTT_ID']];
87
+			}
88
+			if (! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
89
+				$input_fields['Datetime.EVT_ID'] = ['IN', $input_fields['Datetime.EVT_ID']];
90
+			}
91
+		}
92
+
93
+		/**
94
+		 * Determine where we're at in the Graph and adjust the query context appropriately.
95
+		 */
96
+		if ($this->source instanceof EE_Datetime) {
97
+			$where_params['Datetime.DTT_ID'] = $this->source->ID();
98
+		}
99
+
100
+		/**
101
+		 * Merge the input_fields with the default query_args
102
+		 */
103
+		if (! empty($input_fields)) {
104
+			$where_params = array_merge($where_params, $input_fields);
105
+		}
106
+
107
+		list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID');
108
+
109
+		$search = isset($this->args['where']) ? $this->getSearchKeywords($this->args['where']) : '';
110
+
111
+		if (! empty($search)) {
112
+			// use OR operator to search in any of the fields
113
+			$where_params['OR'] = array(
114
+				'TKT_name'        => array('LIKE', '%' . $search . '%'),
115
+				'TKT_description' => array('LIKE', '%' . $search . '%'),
116
+			);
117
+		}
118
+
119
+		// If default tickets should be included.
120
+		if (! empty($this->args['where']['includeDefaultTickets'])) {
121
+			/**
122
+			 * We need to get each ticket that
123
+			 * - satisfies $where_params above
124
+			 * OR
125
+			 * - it's a default ticket
126
+			 */
127
+			$where_params = [
128
+				'OR' => [
129
+					// use extra OR instead of AND to avoid it getting overridden
130
+					'OR' => [
131
+						'AND' => [
132
+							'TKT_deleted'    => ['IN', [true, false]],
133
+							'TKT_is_default' => 1,
134
+						]
135
+					],
136
+					'AND' => $where_params,
137
+				],
138
+			];
139
+		}
140
+
141
+		$where_params = apply_filters(
142
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_where_params',
143
+			$where_params,
144
+			$this->source,
145
+			$this->args
146
+		);
147
+
148
+		$query_args[] = $where_params;
149
+
150
+		/**
151
+		 * Return the $query_args
152
+		 */
153
+		return apply_filters(
154
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_query_args',
155
+			$query_args,
156
+			$this->source,
157
+			$this->args
158
+		);
159
+	}
160
+
161
+
162
+	/**
163
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
164
+	 * friendly keys.
165
+	 *
166
+	 * @param array $where_args
167
+	 * @return array
168
+	 */
169
+	public function sanitizeInputFields(array $where_args)
170
+	{
171
+		$arg_mapping = [
172
+			'event'        => 'Datetime.EVT_ID',
173
+			'eventIn'      => 'Datetime.EVT_ID',
174
+			'eventIdIn'    => 'Datetime.EVT_ID',
175
+			'eventId'      => 'Datetime.EVT_ID', // priority.
176
+			'datetime'     => 'Datetime.DTT_ID',
177
+			'datetimeIn'   => 'Datetime.DTT_ID',
178
+			'datetimeIdIn' => 'Datetime.DTT_ID',
179
+			'datetimeId'   => 'Datetime.DTT_ID', // priority.
180
+			'isDefault'    => 'TKT_is_default',
181
+			'isRequired'   => 'TKT_required',
182
+			'isTaxable'    => 'TKT_taxable',
183
+			'isTrashed'    => 'TKT_deleted',
184
+		];
185
+		return $this->sanitizeWhereArgsForInputFields(
186
+			$where_args,
187
+			$arg_mapping,
188
+			['datetime', 'datetimeIn', 'event', 'eventIn']
189
+		);
190
+	}
191 191
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
          * Collect the input_fields and sanitize them to prepare them for sending to the Query
79 79
          */
80 80
         $input_fields = [];
81
-        if (! empty($this->args['where'])) {
81
+        if ( ! empty($this->args['where'])) {
82 82
             $input_fields = $this->sanitizeInputFields($this->args['where']);
83 83
 
84 84
             // Use the proper operator.
85
-            if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
85
+            if ( ! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
86 86
                 $input_fields['Datetime.DTT_ID'] = ['IN', $input_fields['Datetime.DTT_ID']];
87 87
             }
88
-            if (! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
88
+            if ( ! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
89 89
                 $input_fields['Datetime.EVT_ID'] = ['IN', $input_fields['Datetime.EVT_ID']];
90 90
             }
91 91
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         /**
101 101
          * Merge the input_fields with the default query_args
102 102
          */
103
-        if (! empty($input_fields)) {
103
+        if ( ! empty($input_fields)) {
104 104
             $where_params = array_merge($where_params, $input_fields);
105 105
         }
106 106
 
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 
109 109
         $search = isset($this->args['where']) ? $this->getSearchKeywords($this->args['where']) : '';
110 110
 
111
-        if (! empty($search)) {
111
+        if ( ! empty($search)) {
112 112
             // use OR operator to search in any of the fields
113 113
             $where_params['OR'] = array(
114
-                'TKT_name'        => array('LIKE', '%' . $search . '%'),
115
-                'TKT_description' => array('LIKE', '%' . $search . '%'),
114
+                'TKT_name'        => array('LIKE', '%'.$search.'%'),
115
+                'TKT_description' => array('LIKE', '%'.$search.'%'),
116 116
             );
117 117
         }
118 118
 
119 119
         // If default tickets should be included.
120
-        if (! empty($this->args['where']['includeDefaultTickets'])) {
120
+        if ( ! empty($this->args['where']['includeDefaultTickets'])) {
121 121
             /**
122 122
              * We need to get each ticket that
123 123
              * - satisfies $where_params above
Please login to merge, or discard this patch.
core/domain/services/admin/events/editor/EventEditorGraphQLData.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -21,125 +21,125 @@
 block discarded – undo
21 21
 class EventEditorGraphQLData
22 22
 {
23 23
 
24
-    /**
25
-     * @var Event $event
26
-     */
27
-    protected $event;
28
-
29
-    /**
30
-     * @var Datetimes $datetimes
31
-     */
32
-    protected $datetimes;
33
-
34
-    /**
35
-     * @var Prices $prices
36
-     */
37
-    protected $prices;
38
-
39
-    /**
40
-     * @var PriceTypes $price_types
41
-     */
42
-    protected $price_types;
43
-
44
-    /**
45
-     * @var Tickets $tickets
46
-     */
47
-    protected $tickets;
48
-
49
-    /**
50
-     * @var EventEntityRelations $relations
51
-     */
52
-    protected $relations;
53
-
54
-    /**
55
-     * @var EventManagers $managers
56
-     */
57
-    protected $managers;
58
-
59
-    /**
60
-     * @var NewEventDefaultEntities $default_entities
61
-     */
62
-    protected $default_entities;
63
-
64
-
65
-    /**
66
-     * EventEditorGraphQLData constructor.
67
-     *
68
-     * @param Datetimes               $datetimes
69
-     * @param Event                   $event
70
-     * @param Prices                  $prices
71
-     * @param PriceTypes              $price_types
72
-     * @param Tickets                 $tickets
73
-     * @param EventEntityRelations    $relations
74
-     * @param EventManagers           $managers
75
-     * @param NewEventDefaultEntities $default_entities
76
-     */
77
-    public function __construct(
78
-        Datetimes $datetimes,
79
-        Event $event,
80
-        Prices $prices,
81
-        PriceTypes $price_types,
82
-        Tickets $tickets,
83
-        EventEntityRelations $relations,
84
-        EventManagers $managers,
85
-        NewEventDefaultEntities $default_entities
86
-    ) {
87
-        $this->datetimes        = $datetimes;
88
-        $this->event            = $event;
89
-        $this->default_entities = $default_entities;
90
-        $this->prices           = $prices;
91
-        $this->price_types      = $price_types;
92
-        $this->managers         = $managers;
93
-        $this->relations        = $relations;
94
-        $this->tickets          = $tickets;
95
-    }
96
-
97
-
98
-    /**
99
-     * @param int $eventId
100
-     * @return array
101
-     * @throws EE_Error
102
-     * @throws ReflectionException
103
-     * @since $VID:$
104
-     */
105
-    public function getData(int $eventId)
106
-    {
107
-        $event = $this->event->getData(['id' => $eventId]);
108
-        $datetimes = $this->datetimes->getData(['eventId' => $eventId]);
109
-        $eventManagers = $this->managers ->getData($eventId);
110
-
111
-        // Avoid undefined variable warning in PHP >= 7.3
112
-        $tickets = null;
113
-        $prices  = null;
114
-
115
-        if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) {
116
-            $this->default_entities->getData($eventId);
117
-            $datetimes = $this->datetimes->getData(['eventId' => $eventId]);
118
-        }
119
-
120
-        $tickets = $this->tickets->getData([
121
-            'eventId'               => $eventId,
122
-            'includeDefaultTickets' => true,
123
-        ]);
124
-
125
-        $prices = $this->prices->getData([
126
-            'eventId'                     => $eventId,
127
-            'includeDefaultTicketsPrices' => true,
128
-            'includeDefaultPrices'        => true,
129
-        ]);
130
-
131
-        $priceTypes = $this->price_types->getData();
132
-
133
-        $relations = $this->relations->getData($eventId);
134
-
135
-        return compact(
136
-            'datetimes',
137
-            'event',
138
-            'eventManagers',
139
-            'prices',
140
-            'priceTypes',
141
-            'relations',
142
-            'tickets'
143
-        );
144
-    }
24
+	/**
25
+	 * @var Event $event
26
+	 */
27
+	protected $event;
28
+
29
+	/**
30
+	 * @var Datetimes $datetimes
31
+	 */
32
+	protected $datetimes;
33
+
34
+	/**
35
+	 * @var Prices $prices
36
+	 */
37
+	protected $prices;
38
+
39
+	/**
40
+	 * @var PriceTypes $price_types
41
+	 */
42
+	protected $price_types;
43
+
44
+	/**
45
+	 * @var Tickets $tickets
46
+	 */
47
+	protected $tickets;
48
+
49
+	/**
50
+	 * @var EventEntityRelations $relations
51
+	 */
52
+	protected $relations;
53
+
54
+	/**
55
+	 * @var EventManagers $managers
56
+	 */
57
+	protected $managers;
58
+
59
+	/**
60
+	 * @var NewEventDefaultEntities $default_entities
61
+	 */
62
+	protected $default_entities;
63
+
64
+
65
+	/**
66
+	 * EventEditorGraphQLData constructor.
67
+	 *
68
+	 * @param Datetimes               $datetimes
69
+	 * @param Event                   $event
70
+	 * @param Prices                  $prices
71
+	 * @param PriceTypes              $price_types
72
+	 * @param Tickets                 $tickets
73
+	 * @param EventEntityRelations    $relations
74
+	 * @param EventManagers           $managers
75
+	 * @param NewEventDefaultEntities $default_entities
76
+	 */
77
+	public function __construct(
78
+		Datetimes $datetimes,
79
+		Event $event,
80
+		Prices $prices,
81
+		PriceTypes $price_types,
82
+		Tickets $tickets,
83
+		EventEntityRelations $relations,
84
+		EventManagers $managers,
85
+		NewEventDefaultEntities $default_entities
86
+	) {
87
+		$this->datetimes        = $datetimes;
88
+		$this->event            = $event;
89
+		$this->default_entities = $default_entities;
90
+		$this->prices           = $prices;
91
+		$this->price_types      = $price_types;
92
+		$this->managers         = $managers;
93
+		$this->relations        = $relations;
94
+		$this->tickets          = $tickets;
95
+	}
96
+
97
+
98
+	/**
99
+	 * @param int $eventId
100
+	 * @return array
101
+	 * @throws EE_Error
102
+	 * @throws ReflectionException
103
+	 * @since $VID:$
104
+	 */
105
+	public function getData(int $eventId)
106
+	{
107
+		$event = $this->event->getData(['id' => $eventId]);
108
+		$datetimes = $this->datetimes->getData(['eventId' => $eventId]);
109
+		$eventManagers = $this->managers ->getData($eventId);
110
+
111
+		// Avoid undefined variable warning in PHP >= 7.3
112
+		$tickets = null;
113
+		$prices  = null;
114
+
115
+		if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) {
116
+			$this->default_entities->getData($eventId);
117
+			$datetimes = $this->datetimes->getData(['eventId' => $eventId]);
118
+		}
119
+
120
+		$tickets = $this->tickets->getData([
121
+			'eventId'               => $eventId,
122
+			'includeDefaultTickets' => true,
123
+		]);
124
+
125
+		$prices = $this->prices->getData([
126
+			'eventId'                     => $eventId,
127
+			'includeDefaultTicketsPrices' => true,
128
+			'includeDefaultPrices'        => true,
129
+		]);
130
+
131
+		$priceTypes = $this->price_types->getData();
132
+
133
+		$relations = $this->relations->getData($eventId);
134
+
135
+		return compact(
136
+			'datetimes',
137
+			'event',
138
+			'eventManagers',
139
+			'prices',
140
+			'priceTypes',
141
+			'relations',
142
+			'tickets'
143
+		);
144
+	}
145 145
 }
Please login to merge, or discard this patch.
core/domain/services/admin/events/editor/EventEntityRelations.php 2 patches
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -16,146 +16,146 @@
 block discarded – undo
16 16
 class EventEntityRelations extends EventEditorData
17 17
 {
18 18
 
19
-    /**
20
-     * @param array $data
21
-     */
22
-    private $data;
19
+	/**
20
+	 * @param array $data
21
+	 */
22
+	private $data;
23 23
 
24
-    /**
25
-     * @param int $eventId
26
-     * @return array
27
-     * @throws EE_Error
28
-     * @since $VID:$
29
-     */
30
-    public function getData(int $eventId)
31
-    {
32
-        $this->data = [
33
-            'datetimes' => [],
34
-            'tickets'   => [],
35
-            'prices'    => [],
36
-        ];
24
+	/**
25
+	 * @param int $eventId
26
+	 * @return array
27
+	 * @throws EE_Error
28
+	 * @since $VID:$
29
+	 */
30
+	public function getData(int $eventId)
31
+	{
32
+		$this->data = [
33
+			'datetimes' => [],
34
+			'tickets'   => [],
35
+			'prices'    => [],
36
+		];
37 37
 
38
-        $datetimeIds = $this->processDatetimes($eventId);
39
-        $ticketIds = $this->processTickets($datetimeIds);
40
-        $this->processPrices($ticketIds);
38
+		$datetimeIds = $this->processDatetimes($eventId);
39
+		$ticketIds = $this->processTickets($datetimeIds);
40
+		$this->processPrices($ticketIds);
41 41
 
42
-        return $this->data;
43
-    }
42
+		return $this->data;
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * @param int $eventId
48
-     * @return array
49
-     * @throws EE_Error
50
-     * @since $VID:$
51
-     */
52
-    private function processDatetimes(int $eventId)
53
-    {
54
-        $related_models = [
55
-            'tickets' => $this->ticket_model,
56
-        ];
57
-        // Get the IDs of event datetimes.
58
-        $datetimeIds = $this->datetime_model->get_col([
59
-            [ 'EVT_ID' => $eventId ],
60
-            'default_where_conditions' => 'minimum',
61
-        ]);
62
-        foreach ($datetimeIds as $datetimeId) {
63
-            $GID = $this->utilities->convertToGlobalId($this->datetime_model->item_name(), $datetimeId);
64
-            foreach ($related_models as $key => $model) {
65
-                // Get the IDs of related entities for the datetime ID.
66
-                $Ids = $model->get_col([
67
-                    [ 'Datetime.DTT_ID' => $datetimeId ],
68
-                    'default_where_conditions' => 'minimum',
69
-                ]);
70
-                $this->data['datetimes'][ $GID ][ $key ] = ! empty($Ids)
71
-                    ? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
72
-                    : [];
73
-            }
74
-        }
75
-        return $datetimeIds;
76
-    }
46
+	/**
47
+	 * @param int $eventId
48
+	 * @return array
49
+	 * @throws EE_Error
50
+	 * @since $VID:$
51
+	 */
52
+	private function processDatetimes(int $eventId)
53
+	{
54
+		$related_models = [
55
+			'tickets' => $this->ticket_model,
56
+		];
57
+		// Get the IDs of event datetimes.
58
+		$datetimeIds = $this->datetime_model->get_col([
59
+			[ 'EVT_ID' => $eventId ],
60
+			'default_where_conditions' => 'minimum',
61
+		]);
62
+		foreach ($datetimeIds as $datetimeId) {
63
+			$GID = $this->utilities->convertToGlobalId($this->datetime_model->item_name(), $datetimeId);
64
+			foreach ($related_models as $key => $model) {
65
+				// Get the IDs of related entities for the datetime ID.
66
+				$Ids = $model->get_col([
67
+					[ 'Datetime.DTT_ID' => $datetimeId ],
68
+					'default_where_conditions' => 'minimum',
69
+				]);
70
+				$this->data['datetimes'][ $GID ][ $key ] = ! empty($Ids)
71
+					? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
72
+					: [];
73
+			}
74
+		}
75
+		return $datetimeIds;
76
+	}
77 77
 
78 78
 
79
-    /**
80
-     * @param array $datetimeIds
81
-     * @return array
82
-     * @throws EE_Error
83
-     * @since $VID:$
84
-     */
85
-    private function processTickets(array $datetimeIds)
86
-    {
87
-        $related_models = [
88
-            'datetimes' => $this->datetime_model,
89
-            'prices'    => $this->price_model,
90
-        ];
91
-        // Get the IDs of all datetime tickets.
92
-        $ticketIds = $this->ticket_model->get_col([
93
-            [
94
-                'OR' => [
95
-                    'Datetime.DTT_ID' => ['IN', $datetimeIds],
96
-                    'TKT_is_default' => 1,
97
-                ]
98
-            ],
99
-            'default_where_conditions' => 'minimum',
100
-        ]);
101
-        foreach ($ticketIds as $ticketId) {
102
-            $GID = $this->utilities->convertToGlobalId($this->ticket_model->item_name(), $ticketId);
79
+	/**
80
+	 * @param array $datetimeIds
81
+	 * @return array
82
+	 * @throws EE_Error
83
+	 * @since $VID:$
84
+	 */
85
+	private function processTickets(array $datetimeIds)
86
+	{
87
+		$related_models = [
88
+			'datetimes' => $this->datetime_model,
89
+			'prices'    => $this->price_model,
90
+		];
91
+		// Get the IDs of all datetime tickets.
92
+		$ticketIds = $this->ticket_model->get_col([
93
+			[
94
+				'OR' => [
95
+					'Datetime.DTT_ID' => ['IN', $datetimeIds],
96
+					'TKT_is_default' => 1,
97
+				]
98
+			],
99
+			'default_where_conditions' => 'minimum',
100
+		]);
101
+		foreach ($ticketIds as $ticketId) {
102
+			$GID = $this->utilities->convertToGlobalId($this->ticket_model->item_name(), $ticketId);
103 103
 
104
-            foreach ($related_models as $key => $model) {
105
-                // Get the IDs of related entities for the ticket ID.
106
-                $Ids = $model->get_col([
107
-                    [ 'Ticket.TKT_ID' => $ticketId ],
108
-                    'default_where_conditions' => 'minimum',
109
-                ]);
110
-                $this->data['tickets'][ $GID ][ $key ] = ! empty($Ids)
111
-                    ? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
112
-                    : [];
113
-            }
114
-        }
115
-        return $ticketIds;
116
-    }
104
+			foreach ($related_models as $key => $model) {
105
+				// Get the IDs of related entities for the ticket ID.
106
+				$Ids = $model->get_col([
107
+					[ 'Ticket.TKT_ID' => $ticketId ],
108
+					'default_where_conditions' => 'minimum',
109
+				]);
110
+				$this->data['tickets'][ $GID ][ $key ] = ! empty($Ids)
111
+					? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
112
+					: [];
113
+			}
114
+		}
115
+		return $ticketIds;
116
+	}
117 117
 
118 118
 
119
-    /**
120
-     * @param array $ticketIds
121
-     * @throws EE_Error
122
-     * @since $VID:$
123
-     */
124
-    private function processPrices(array $ticketIds)
125
-    {
126
-        $related_models = [
127
-            'tickets'    => $this->ticket_model,
128
-            'priceTypes' => $this->price_type_model,
129
-        ];
130
-        // Get the IDs of all ticket prices and default prices
131
-        $priceIds = $this->price_model->get_col([
132
-            [
133
-                'OR' => [
134
-                    // either the price is related to any of these tickets
135
-                    'Ticket.TKT_ID' => ['IN', $ticketIds],
136
-                    // or it's a default price and not trashed
137
-                    'AND' => [
138
-                        'PRC_deleted'    => 0,
139
-                        'PRC_is_default' => 1,
140
-                    ],
141
-                ],
142
-            ],
143
-            'group_by'                 => 'PRC_ID',
144
-            'default_where_conditions' => 'minimum',
145
-        ]);
146
-        foreach ($priceIds as $priceId) {
147
-            $GID = $this->utilities->convertToGlobalId($this->price_model->item_name(), $priceId);
119
+	/**
120
+	 * @param array $ticketIds
121
+	 * @throws EE_Error
122
+	 * @since $VID:$
123
+	 */
124
+	private function processPrices(array $ticketIds)
125
+	{
126
+		$related_models = [
127
+			'tickets'    => $this->ticket_model,
128
+			'priceTypes' => $this->price_type_model,
129
+		];
130
+		// Get the IDs of all ticket prices and default prices
131
+		$priceIds = $this->price_model->get_col([
132
+			[
133
+				'OR' => [
134
+					// either the price is related to any of these tickets
135
+					'Ticket.TKT_ID' => ['IN', $ticketIds],
136
+					// or it's a default price and not trashed
137
+					'AND' => [
138
+						'PRC_deleted'    => 0,
139
+						'PRC_is_default' => 1,
140
+					],
141
+				],
142
+			],
143
+			'group_by'                 => 'PRC_ID',
144
+			'default_where_conditions' => 'minimum',
145
+		]);
146
+		foreach ($priceIds as $priceId) {
147
+			$GID = $this->utilities->convertToGlobalId($this->price_model->item_name(), $priceId);
148 148
 
149
-            foreach ($related_models as $key => $model) {
150
-                // Get the IDs of related entities for the price ID.
151
-                $Ids = $model->get_col([
152
-                    [ 'Price.PRC_ID' => $priceId ],
153
-                    'default_where_conditions' => 'minimum',
154
-                ]);
155
-                $this->data['prices'][ $GID ][ $key ] = ! empty($Ids)
156
-                    ? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
157
-                    : [];
158
-            }
159
-        }
160
-    }
149
+			foreach ($related_models as $key => $model) {
150
+				// Get the IDs of related entities for the price ID.
151
+				$Ids = $model->get_col([
152
+					[ 'Price.PRC_ID' => $priceId ],
153
+					'default_where_conditions' => 'minimum',
154
+				]);
155
+				$this->data['prices'][ $GID ][ $key ] = ! empty($Ids)
156
+					? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
157
+					: [];
158
+			}
159
+		}
160
+	}
161 161
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         ];
57 57
         // Get the IDs of event datetimes.
58 58
         $datetimeIds = $this->datetime_model->get_col([
59
-            [ 'EVT_ID' => $eventId ],
59
+            ['EVT_ID' => $eventId],
60 60
             'default_where_conditions' => 'minimum',
61 61
         ]);
62 62
         foreach ($datetimeIds as $datetimeId) {
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
             foreach ($related_models as $key => $model) {
65 65
                 // Get the IDs of related entities for the datetime ID.
66 66
                 $Ids = $model->get_col([
67
-                    [ 'Datetime.DTT_ID' => $datetimeId ],
67
+                    ['Datetime.DTT_ID' => $datetimeId],
68 68
                     'default_where_conditions' => 'minimum',
69 69
                 ]);
70
-                $this->data['datetimes'][ $GID ][ $key ] = ! empty($Ids)
70
+                $this->data['datetimes'][$GID][$key] = ! empty($Ids)
71 71
                     ? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
72 72
                     : [];
73 73
             }
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
             foreach ($related_models as $key => $model) {
105 105
                 // Get the IDs of related entities for the ticket ID.
106 106
                 $Ids = $model->get_col([
107
-                    [ 'Ticket.TKT_ID' => $ticketId ],
107
+                    ['Ticket.TKT_ID' => $ticketId],
108 108
                     'default_where_conditions' => 'minimum',
109 109
                 ]);
110
-                $this->data['tickets'][ $GID ][ $key ] = ! empty($Ids)
110
+                $this->data['tickets'][$GID][$key] = ! empty($Ids)
111 111
                     ? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
112 112
                     : [];
113 113
             }
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
             foreach ($related_models as $key => $model) {
150 150
                 // Get the IDs of related entities for the price ID.
151 151
                 $Ids = $model->get_col([
152
-                    [ 'Price.PRC_ID' => $priceId ],
152
+                    ['Price.PRC_ID' => $priceId],
153 153
                     'default_where_conditions' => 'minimum',
154 154
                 ]);
155
-                $this->data['prices'][ $GID ][ $key ] = ! empty($Ids)
155
+                $this->data['prices'][$GID][$key] = ! empty($Ids)
156 156
                     ? $this->utilities->convertToGlobalId($model->item_name(), $Ids)
157 157
                     : [];
158 158
             }
Please login to merge, or discard this patch.