@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - $this->setName($this->namespace . 'TicketStatusEnum'); |
|
24 | + $this->setName($this->namespace.'TicketStatusEnum'); |
|
25 | 25 | $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso')); |
26 | 26 | parent::__construct(); |
27 | 27 | } |
@@ -16,38 +16,38 @@ |
||
16 | 16 | class TicketStatusEnum extends EnumBase |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * TicketStatusEnum constructor. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $this->setName($this->namespace . 'TicketStatusEnum'); |
|
25 | - $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso')); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
19 | + /** |
|
20 | + * TicketStatusEnum constructor. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $this->setName($this->namespace . 'TicketStatusEnum'); |
|
25 | + $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso')); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - protected function getValues(): array |
|
34 | - { |
|
35 | - return [ |
|
36 | - 'SOLD_OUT' => [ |
|
37 | - 'value' => EE_Ticket::sold_out, |
|
38 | - ], |
|
39 | - 'EXPIRED' => [ |
|
40 | - 'value' => EE_Ticket::expired, |
|
41 | - ], |
|
42 | - 'ARCHIVED' => [ |
|
43 | - 'value' => EE_Ticket::archived, |
|
44 | - ], |
|
45 | - 'PENDING' => [ |
|
46 | - 'value' => EE_Ticket::pending, |
|
47 | - ], |
|
48 | - 'ONSALE' => [ |
|
49 | - 'value' => EE_Ticket::onsale, |
|
50 | - ], |
|
51 | - ]; |
|
52 | - } |
|
30 | + /** |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + protected function getValues(): array |
|
34 | + { |
|
35 | + return [ |
|
36 | + 'SOLD_OUT' => [ |
|
37 | + 'value' => EE_Ticket::sold_out, |
|
38 | + ], |
|
39 | + 'EXPIRED' => [ |
|
40 | + 'value' => EE_Ticket::expired, |
|
41 | + ], |
|
42 | + 'ARCHIVED' => [ |
|
43 | + 'value' => EE_Ticket::archived, |
|
44 | + ], |
|
45 | + 'PENDING' => [ |
|
46 | + 'value' => EE_Ticket::pending, |
|
47 | + ], |
|
48 | + 'ONSALE' => [ |
|
49 | + 'value' => EE_Ticket::onsale, |
|
50 | + ], |
|
51 | + ]; |
|
52 | + } |
|
53 | 53 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - $this->setName($this->namespace . 'DatetimeStatusEnum'); |
|
24 | + $this->setName($this->namespace.'DatetimeStatusEnum'); |
|
25 | 25 | $this->setDescription(esc_html__('Datetime status', 'event_espresso')); |
26 | 26 | parent::__construct(); |
27 | 27 | } |
@@ -16,44 +16,44 @@ |
||
16 | 16 | class DatetimeStatusEnum extends EnumBase |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * DatetimeStatusEnum constructor. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $this->setName($this->namespace . 'DatetimeStatusEnum'); |
|
25 | - $this->setDescription(esc_html__('Datetime status', 'event_espresso')); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
19 | + /** |
|
20 | + * DatetimeStatusEnum constructor. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $this->setName($this->namespace . 'DatetimeStatusEnum'); |
|
25 | + $this->setDescription(esc_html__('Datetime status', 'event_espresso')); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - protected function getValues(): array |
|
34 | - { |
|
35 | - return [ |
|
36 | - 'SOLD_OUT' => [ |
|
37 | - 'value' => EE_Datetime::sold_out, |
|
38 | - ], |
|
39 | - 'ACTIVE' => [ |
|
40 | - 'value' => EE_Datetime::active, |
|
41 | - ], |
|
42 | - 'UPCOMING' => [ |
|
43 | - 'value' => EE_Datetime::upcoming, |
|
44 | - ], |
|
45 | - 'POSTPONED' => [ |
|
46 | - 'value' => EE_Datetime::postponed, |
|
47 | - ], |
|
48 | - 'CANCELLED' => [ |
|
49 | - 'value' => EE_Datetime::cancelled, |
|
50 | - ], |
|
51 | - 'EXPIRED' => [ |
|
52 | - 'value' => EE_Datetime::expired, |
|
53 | - ], |
|
54 | - 'INACTIVE' => [ |
|
55 | - 'value' => EE_Datetime::inactive, |
|
56 | - ], |
|
57 | - ]; |
|
58 | - } |
|
30 | + /** |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + protected function getValues(): array |
|
34 | + { |
|
35 | + return [ |
|
36 | + 'SOLD_OUT' => [ |
|
37 | + 'value' => EE_Datetime::sold_out, |
|
38 | + ], |
|
39 | + 'ACTIVE' => [ |
|
40 | + 'value' => EE_Datetime::active, |
|
41 | + ], |
|
42 | + 'UPCOMING' => [ |
|
43 | + 'value' => EE_Datetime::upcoming, |
|
44 | + ], |
|
45 | + 'POSTPONED' => [ |
|
46 | + 'value' => EE_Datetime::postponed, |
|
47 | + ], |
|
48 | + 'CANCELLED' => [ |
|
49 | + 'value' => EE_Datetime::cancelled, |
|
50 | + ], |
|
51 | + 'EXPIRED' => [ |
|
52 | + 'value' => EE_Datetime::expired, |
|
53 | + ], |
|
54 | + 'INACTIVE' => [ |
|
55 | + 'value' => EE_Datetime::inactive, |
|
56 | + ], |
|
57 | + ]; |
|
58 | + } |
|
59 | 59 | } |
@@ -22,55 +22,55 @@ |
||
22 | 22 | */ |
23 | 23 | class ConfirmEventDeletionForm extends \EE_Form_Section_Proper |
24 | 24 | { |
25 | - /** |
|
26 | - * @var EE_Event[] |
|
27 | - */ |
|
28 | - protected $events; |
|
29 | - public function __construct($event_ids, $options_array = array()) |
|
30 | - { |
|
31 | - if (! isset($options_array['subsections'])) { |
|
32 | - $options_array['subsections'] = []; |
|
33 | - } |
|
34 | - if (! isset($options_array['subsections']['events'])) { |
|
35 | - $events_subsection = new \EE_Form_Section_Proper(); |
|
36 | - $options_array['subsections']['events'] = $events_subsection; |
|
37 | - } |
|
38 | - $events = EEM_Event::instance()->get_all_deleted_and_undeleted( |
|
39 | - [ |
|
40 | - [ |
|
41 | - 'EVT_ID' => ['IN',$event_ids] |
|
42 | - ] |
|
43 | - ] |
|
44 | - ); |
|
45 | - if (! is_array($events)) { |
|
46 | - throw new UnexpectedEntityException($event_ids, 'array'); |
|
47 | - } |
|
48 | - $this->events = $events; |
|
49 | - $events_inputs = [ |
|
50 | - ]; |
|
51 | - foreach ($events as $event) { |
|
52 | - $events_inputs[ $event->ID() ] = new EE_Checkbox_Multi_Input( |
|
53 | - [ |
|
54 | - 'yes' => $event->name(), |
|
55 | - ], |
|
56 | - [ |
|
57 | - 'html_label_text' => esc_html__('Please confirm you wish to delete:', 'event_espresso'), |
|
58 | - 'required' => true |
|
59 | - ] |
|
60 | - ); |
|
61 | - } |
|
62 | - $events_subsection->add_subsections($events_inputs); |
|
63 | - $options_array['subsections']['backup'] = new EE_Checkbox_Multi_Input( |
|
64 | - [ |
|
65 | - 'yes' => esc_html__('I have backed up my database.', 'event_espresso') |
|
66 | - ], |
|
67 | - [ |
|
68 | - 'html_label_text' => esc_html__('Deleting this data cannot be undone. Please confirm you have a usable database backup.', 'event_espresso'), |
|
69 | - 'required' => true |
|
70 | - ] |
|
71 | - ); |
|
72 | - parent::__construct($options_array); |
|
73 | - } |
|
25 | + /** |
|
26 | + * @var EE_Event[] |
|
27 | + */ |
|
28 | + protected $events; |
|
29 | + public function __construct($event_ids, $options_array = array()) |
|
30 | + { |
|
31 | + if (! isset($options_array['subsections'])) { |
|
32 | + $options_array['subsections'] = []; |
|
33 | + } |
|
34 | + if (! isset($options_array['subsections']['events'])) { |
|
35 | + $events_subsection = new \EE_Form_Section_Proper(); |
|
36 | + $options_array['subsections']['events'] = $events_subsection; |
|
37 | + } |
|
38 | + $events = EEM_Event::instance()->get_all_deleted_and_undeleted( |
|
39 | + [ |
|
40 | + [ |
|
41 | + 'EVT_ID' => ['IN',$event_ids] |
|
42 | + ] |
|
43 | + ] |
|
44 | + ); |
|
45 | + if (! is_array($events)) { |
|
46 | + throw new UnexpectedEntityException($event_ids, 'array'); |
|
47 | + } |
|
48 | + $this->events = $events; |
|
49 | + $events_inputs = [ |
|
50 | + ]; |
|
51 | + foreach ($events as $event) { |
|
52 | + $events_inputs[ $event->ID() ] = new EE_Checkbox_Multi_Input( |
|
53 | + [ |
|
54 | + 'yes' => $event->name(), |
|
55 | + ], |
|
56 | + [ |
|
57 | + 'html_label_text' => esc_html__('Please confirm you wish to delete:', 'event_espresso'), |
|
58 | + 'required' => true |
|
59 | + ] |
|
60 | + ); |
|
61 | + } |
|
62 | + $events_subsection->add_subsections($events_inputs); |
|
63 | + $options_array['subsections']['backup'] = new EE_Checkbox_Multi_Input( |
|
64 | + [ |
|
65 | + 'yes' => esc_html__('I have backed up my database.', 'event_espresso') |
|
66 | + ], |
|
67 | + [ |
|
68 | + 'html_label_text' => esc_html__('Deleting this data cannot be undone. Please confirm you have a usable database backup.', 'event_espresso'), |
|
69 | + 'required' => true |
|
70 | + ] |
|
71 | + ); |
|
72 | + parent::__construct($options_array); |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | // End of file ConfirmEventDeletionForm.php |
76 | 76 | // Location: EventEspresso\admin_pages\events\form_sections/ConfirmEventDeletionForm.php |
@@ -28,28 +28,28 @@ |
||
28 | 28 | protected $events; |
29 | 29 | public function __construct($event_ids, $options_array = array()) |
30 | 30 | { |
31 | - if (! isset($options_array['subsections'])) { |
|
31 | + if ( ! isset($options_array['subsections'])) { |
|
32 | 32 | $options_array['subsections'] = []; |
33 | 33 | } |
34 | - if (! isset($options_array['subsections']['events'])) { |
|
34 | + if ( ! isset($options_array['subsections']['events'])) { |
|
35 | 35 | $events_subsection = new \EE_Form_Section_Proper(); |
36 | 36 | $options_array['subsections']['events'] = $events_subsection; |
37 | 37 | } |
38 | 38 | $events = EEM_Event::instance()->get_all_deleted_and_undeleted( |
39 | 39 | [ |
40 | 40 | [ |
41 | - 'EVT_ID' => ['IN',$event_ids] |
|
41 | + 'EVT_ID' => ['IN', $event_ids] |
|
42 | 42 | ] |
43 | 43 | ] |
44 | 44 | ); |
45 | - if (! is_array($events)) { |
|
45 | + if ( ! is_array($events)) { |
|
46 | 46 | throw new UnexpectedEntityException($event_ids, 'array'); |
47 | 47 | } |
48 | 48 | $this->events = $events; |
49 | 49 | $events_inputs = [ |
50 | 50 | ]; |
51 | 51 | foreach ($events as $event) { |
52 | - $events_inputs[ $event->ID() ] = new EE_Checkbox_Multi_Input( |
|
52 | + $events_inputs[$event->ID()] = new EE_Checkbox_Multi_Input( |
|
53 | 53 | [ |
54 | 54 | 'yes' => $event->name(), |
55 | 55 | ], |
@@ -10,29 +10,29 @@ |
||
10 | 10 | class EE_Email_Confirm_Input extends EE_Form_Input_Base |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * @param array $input_settings |
|
15 | - */ |
|
16 | - public function __construct($input_settings = array()) |
|
17 | - { |
|
18 | - $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
19 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
20 | - $this->_add_validation_strategy( |
|
21 | - new EE_Email_Validation_Strategy( |
|
22 | - isset($input_settings['validation_error_message']) |
|
23 | - ? $input_settings['validation_error_message'] |
|
24 | - : null |
|
25 | - ) |
|
26 | - ); |
|
27 | - $this->_add_validation_strategy( |
|
28 | - new EE_Equal_To_Validation_Strategy( |
|
29 | - isset($input_settings['validation_error_message']) |
|
30 | - ? $input_settings['validation_error_message'] |
|
31 | - : null, |
|
32 | - '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
33 | - ) |
|
34 | - ); |
|
35 | - parent::__construct($input_settings); |
|
36 | - $this->set_html_class($this->html_class() . ' email'); |
|
37 | - } |
|
13 | + /** |
|
14 | + * @param array $input_settings |
|
15 | + */ |
|
16 | + public function __construct($input_settings = array()) |
|
17 | + { |
|
18 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
19 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
20 | + $this->_add_validation_strategy( |
|
21 | + new EE_Email_Validation_Strategy( |
|
22 | + isset($input_settings['validation_error_message']) |
|
23 | + ? $input_settings['validation_error_message'] |
|
24 | + : null |
|
25 | + ) |
|
26 | + ); |
|
27 | + $this->_add_validation_strategy( |
|
28 | + new EE_Equal_To_Validation_Strategy( |
|
29 | + isset($input_settings['validation_error_message']) |
|
30 | + ? $input_settings['validation_error_message'] |
|
31 | + : null, |
|
32 | + '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
33 | + ) |
|
34 | + ); |
|
35 | + parent::__construct($input_settings); |
|
36 | + $this->set_html_class($this->html_class() . ' email'); |
|
37 | + } |
|
38 | 38 | } |
@@ -29,10 +29,10 @@ |
||
29 | 29 | isset($input_settings['validation_error_message']) |
30 | 30 | ? $input_settings['validation_error_message'] |
31 | 31 | : null, |
32 | - '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
32 | + '#'.str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
33 | 33 | ) |
34 | 34 | ); |
35 | 35 | parent::__construct($input_settings); |
36 | - $this->set_html_class($this->html_class() . ' email'); |
|
36 | + $this->set_html_class($this->html_class().' email'); |
|
37 | 37 | } |
38 | 38 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function __construct($validation_error_message = '', $compare_to) |
25 | 25 | { |
26 | - if (! $validation_error_message) { |
|
26 | + if ( ! $validation_error_message) { |
|
27 | 27 | $validation_error_message = apply_filters( |
28 | 28 | 'FHEE__EE_Equal_To_Validation_Strategy____construct__validation_error_message', |
29 | 29 | esc_html__('Fields do not match.', 'event_espresso') |
@@ -16,49 +16,49 @@ |
||
16 | 16 | class EE_Equal_To_Validation_Strategy extends EE_Text_Validation_Strategy |
17 | 17 | { |
18 | 18 | |
19 | - protected $_compare_to = null; |
|
19 | + protected $_compare_to = null; |
|
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * @param string $validation_error_message |
|
24 | - */ |
|
25 | - public function __construct($validation_error_message = '', $compare_to) |
|
26 | - { |
|
27 | - if (! $validation_error_message) { |
|
28 | - $validation_error_message = apply_filters( |
|
29 | - 'FHEE__EE_Equal_To_Validation_Strategy____construct__validation_error_message', |
|
30 | - esc_html__('Fields do not match.', 'event_espresso') |
|
31 | - ); |
|
32 | - } |
|
33 | - parent::__construct($validation_error_message); |
|
34 | - $this->_compare_to = $compare_to; |
|
35 | - } |
|
22 | + /** |
|
23 | + * @param string $validation_error_message |
|
24 | + */ |
|
25 | + public function __construct($validation_error_message = '', $compare_to) |
|
26 | + { |
|
27 | + if (! $validation_error_message) { |
|
28 | + $validation_error_message = apply_filters( |
|
29 | + 'FHEE__EE_Equal_To_Validation_Strategy____construct__validation_error_message', |
|
30 | + esc_html__('Fields do not match.', 'event_espresso') |
|
31 | + ); |
|
32 | + } |
|
33 | + parent::__construct($validation_error_message); |
|
34 | + $this->_compare_to = $compare_to; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * just checks the field isn't blank |
|
41 | - * |
|
42 | - * @param $normalized_value |
|
43 | - * @return bool |
|
44 | - * @throws InvalidArgumentException |
|
45 | - * @throws InvalidInterfaceException |
|
46 | - * @throws InvalidDataTypeException |
|
47 | - * @throws EE_Validation_Error |
|
48 | - */ |
|
49 | - public function validate($normalized_value) |
|
50 | - { |
|
51 | - // No need to be validated |
|
52 | - return true; |
|
53 | - } |
|
39 | + /** |
|
40 | + * just checks the field isn't blank |
|
41 | + * |
|
42 | + * @param $normalized_value |
|
43 | + * @return bool |
|
44 | + * @throws InvalidArgumentException |
|
45 | + * @throws InvalidInterfaceException |
|
46 | + * @throws InvalidDataTypeException |
|
47 | + * @throws EE_Validation_Error |
|
48 | + */ |
|
49 | + public function validate($normalized_value) |
|
50 | + { |
|
51 | + // No need to be validated |
|
52 | + return true; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * @return array |
|
59 | - */ |
|
60 | - public function get_jquery_validation_rule_array() |
|
61 | - { |
|
62 | - return array('equalTo' => $this->_compare_to, 'messages' => array('equalTo' => $this->get_validation_error_message())); |
|
63 | - } |
|
57 | + /** |
|
58 | + * @return array |
|
59 | + */ |
|
60 | + public function get_jquery_validation_rule_array() |
|
61 | + { |
|
62 | + return array('equalTo' => $this->_compare_to, 'messages' => array('equalTo' => $this->get_validation_error_message())); |
|
63 | + } |
|
64 | 64 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <?php esc_html_e('URL of Event:', 'event_espresso'); ?> |
8 | 8 | </label> |
9 | 9 | <?php //phpcs:disable Generic.Files.LineLength.TooLong |
10 | - // no new lines within <textarea> here because they'll output whitespace ?> |
|
10 | + // no new lines within <textarea> here because they'll output whitespace ?> |
|
11 | 11 | <textarea id="url-event" cols="30" rows="4" tabindex="112" name="vnu_virtual_url"><?php $_venue->f('VNU_virtual_url'); ?></textarea> |
12 | 12 | <?php //phpcs:enable ?> |
13 | 13 | </p> |
@@ -15,19 +15,19 @@ |
||
15 | 15 | interface ConnectionInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @return array |
|
20 | - * @since $VID:$ |
|
21 | - */ |
|
22 | - public function config(); |
|
18 | + /** |
|
19 | + * @return array |
|
20 | + * @since $VID:$ |
|
21 | + */ |
|
22 | + public function config(); |
|
23 | 23 | |
24 | - /** |
|
25 | - * @param $entity |
|
26 | - * @param $args |
|
27 | - * @param $context |
|
28 | - * @param $info |
|
29 | - * @return array |
|
30 | - * @since $VID:$ |
|
31 | - */ |
|
32 | - public function resolveConnection($entity, $args, $context, $info); |
|
24 | + /** |
|
25 | + * @param $entity |
|
26 | + * @param $args |
|
27 | + * @param $context |
|
28 | + * @param $info |
|
29 | + * @return array |
|
30 | + * @since $VID:$ |
|
31 | + */ |
|
32 | + public function resolveConnection($entity, $args, $context, $info); |
|
33 | 33 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'PriceType', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
41 | + 'toType' => $this->namespace.'PriceType', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'PriceTypes', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
44 | 44 | 'resolve' => [$this, 'resolveConnection'], |
45 | 45 | ]; |
@@ -20,42 +20,42 @@ |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * PriceTypeConnection constructor. |
|
25 | - * |
|
26 | - * @param EEM_Price_Type $model |
|
27 | - */ |
|
28 | - public function __construct(EEM_Price_Type $model) |
|
29 | - { |
|
30 | - parent::__construct($model); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function config(): array |
|
38 | - { |
|
39 | - return [ |
|
40 | - 'fromType' => 'RootQuery', |
|
41 | - 'toType' => $this->namespace . 'PriceType', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
43 | - 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
|
44 | - 'resolve' => [$this, 'resolveConnection'], |
|
45 | - ]; |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * @param $entity |
|
51 | - * @param $args |
|
52 | - * @param $context |
|
53 | - * @param $info |
|
54 | - * @return PriceTypeConnectionResolver |
|
55 | - * @throws Exception |
|
56 | - */ |
|
57 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
58 | - { |
|
59 | - return new PriceTypeConnectionResolver($entity, $args, $context, $info); |
|
60 | - } |
|
23 | + /** |
|
24 | + * PriceTypeConnection constructor. |
|
25 | + * |
|
26 | + * @param EEM_Price_Type $model |
|
27 | + */ |
|
28 | + public function __construct(EEM_Price_Type $model) |
|
29 | + { |
|
30 | + parent::__construct($model); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function config(): array |
|
38 | + { |
|
39 | + return [ |
|
40 | + 'fromType' => 'RootQuery', |
|
41 | + 'toType' => $this->namespace . 'PriceType', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
43 | + 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
|
44 | + 'resolve' => [$this, 'resolveConnection'], |
|
45 | + ]; |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * @param $entity |
|
51 | + * @param $args |
|
52 | + * @param $context |
|
53 | + * @param $info |
|
54 | + * @return PriceTypeConnectionResolver |
|
55 | + * @throws Exception |
|
56 | + */ |
|
57 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
58 | + { |
|
59 | + return new PriceTypeConnectionResolver($entity, $args, $context, $info); |
|
60 | + } |
|
61 | 61 | } |
@@ -67,10 +67,10 @@ |
||
67 | 67 | * the model layer. |
68 | 68 | */ |
69 | 69 | foreach ($keys as $key) { |
70 | - if (isset($result[ $key ])) { |
|
71 | - $loadedItems[ $key ] = $result[ $key ]; |
|
70 | + if (isset($result[$key])) { |
|
71 | + $loadedItems[$key] = $result[$key]; |
|
72 | 72 | } else { |
73 | - $loadedItems[ $key ] = null; |
|
73 | + $loadedItems[$key] = null; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | return $loadedItems; |
@@ -15,65 +15,65 @@ |
||
15 | 15 | */ |
16 | 16 | abstract class AbstractLoader extends AbstractDataLoader |
17 | 17 | { |
18 | - protected $primaryKey; |
|
18 | + protected $primaryKey; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @return EEM_Base |
|
22 | - * @throws EE_Error |
|
23 | - * @throws InvalidArgumentException |
|
24 | - * @throws InvalidDataTypeException |
|
25 | - * @throws InvalidInterfaceException |
|
26 | - */ |
|
27 | - abstract protected function getQuery(): EEM_Base; |
|
20 | + /** |
|
21 | + * @return EEM_Base |
|
22 | + * @throws EE_Error |
|
23 | + * @throws InvalidArgumentException |
|
24 | + * @throws InvalidDataTypeException |
|
25 | + * @throws InvalidInterfaceException |
|
26 | + */ |
|
27 | + abstract protected function getQuery(): EEM_Base; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @param array $keys |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - abstract protected function getWhereParams(array $keys): array; |
|
29 | + /** |
|
30 | + * @param array $keys |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + abstract protected function getWhereParams(array $keys): array; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Given array of keys, loads and returns a map consisting of keys from `keys` array and loaded |
|
37 | - * values |
|
38 | - * |
|
39 | - * Note that order of returned values must match exactly the order of keys. |
|
40 | - * If some entry is not available for given key - it must include null for the missing key. |
|
41 | - * |
|
42 | - * For example: |
|
43 | - * loadKeys(['a', 'b', 'c']) -> ['a' => 'value1, 'b' => null, 'c' => 'value3'] |
|
44 | - * |
|
45 | - * @param array $keys |
|
46 | - * |
|
47 | - * @return array |
|
48 | - * @throws Exception |
|
49 | - */ |
|
50 | - public function loadKeys(array $keys): array |
|
51 | - { |
|
52 | - if (empty($keys)) { |
|
53 | - return $keys; |
|
54 | - } |
|
35 | + /** |
|
36 | + * Given array of keys, loads and returns a map consisting of keys from `keys` array and loaded |
|
37 | + * values |
|
38 | + * |
|
39 | + * Note that order of returned values must match exactly the order of keys. |
|
40 | + * If some entry is not available for given key - it must include null for the missing key. |
|
41 | + * |
|
42 | + * For example: |
|
43 | + * loadKeys(['a', 'b', 'c']) -> ['a' => 'value1, 'b' => null, 'c' => 'value3'] |
|
44 | + * |
|
45 | + * @param array $keys |
|
46 | + * |
|
47 | + * @return array |
|
48 | + * @throws Exception |
|
49 | + */ |
|
50 | + public function loadKeys(array $keys): array |
|
51 | + { |
|
52 | + if (empty($keys)) { |
|
53 | + return $keys; |
|
54 | + } |
|
55 | 55 | |
56 | - $args = [ |
|
57 | - $this->getWhereParams($keys), |
|
58 | - ]; |
|
56 | + $args = [ |
|
57 | + $this->getWhereParams($keys), |
|
58 | + ]; |
|
59 | 59 | |
60 | - $query = $this->getQuery(); |
|
61 | - $result = $query->get_all($args); |
|
60 | + $query = $this->getQuery(); |
|
61 | + $result = $query->get_all($args); |
|
62 | 62 | |
63 | - $loadedItems = []; |
|
63 | + $loadedItems = []; |
|
64 | 64 | |
65 | - /** |
|
66 | - * Loop over the items and return an array of loaded items, |
|
67 | - * where the key is the ID and the value is the Object passed through |
|
68 | - * the model layer. |
|
69 | - */ |
|
70 | - foreach ($keys as $key) { |
|
71 | - if (isset($result[ $key ])) { |
|
72 | - $loadedItems[ $key ] = $result[ $key ]; |
|
73 | - } else { |
|
74 | - $loadedItems[ $key ] = null; |
|
75 | - } |
|
76 | - } |
|
77 | - return $loadedItems; |
|
78 | - } |
|
65 | + /** |
|
66 | + * Loop over the items and return an array of loaded items, |
|
67 | + * where the key is the ID and the value is the Object passed through |
|
68 | + * the model layer. |
|
69 | + */ |
|
70 | + foreach ($keys as $key) { |
|
71 | + if (isset($result[ $key ])) { |
|
72 | + $loadedItems[ $key ] = $result[ $key ]; |
|
73 | + } else { |
|
74 | + $loadedItems[ $key ] = null; |
|
75 | + } |
|
76 | + } |
|
77 | + return $loadedItems; |
|
78 | + } |
|
79 | 79 | } |