@@ -8,24 +8,24 @@ |
||
8 | 8 | */ |
9 | 9 | interface CommandHandlerInterface |
10 | 10 | { |
11 | - /** |
|
12 | - * verifies that the supplied command is the correct class for the handler. |
|
13 | - * |
|
14 | - * !!! IMPORTANT !!! |
|
15 | - * Must return $this (ie: the handler itself) |
|
16 | - * as the CommandBus utilizes method chaining |
|
17 | - * |
|
18 | - * @param CommandInterface $command |
|
19 | - * @return CommandHandlerInterface |
|
20 | - * @since $VID:$ |
|
21 | - */ |
|
22 | - public function verify(CommandInterface $command); |
|
11 | + /** |
|
12 | + * verifies that the supplied command is the correct class for the handler. |
|
13 | + * |
|
14 | + * !!! IMPORTANT !!! |
|
15 | + * Must return $this (ie: the handler itself) |
|
16 | + * as the CommandBus utilizes method chaining |
|
17 | + * |
|
18 | + * @param CommandInterface $command |
|
19 | + * @return CommandHandlerInterface |
|
20 | + * @since $VID:$ |
|
21 | + */ |
|
22 | + public function verify(CommandInterface $command); |
|
23 | 23 | |
24 | - /** |
|
25 | - * Performs the command handler's logic. |
|
26 | - * |
|
27 | - * @param CommandInterface $command |
|
28 | - * @return mixed |
|
29 | - */ |
|
30 | - public function handle(CommandInterface $command); |
|
24 | + /** |
|
25 | + * Performs the command handler's logic. |
|
26 | + * |
|
27 | + * @param CommandInterface $command |
|
28 | + * @return mixed |
|
29 | + */ |
|
30 | + public function handle(CommandInterface $command); |
|
31 | 31 | } |
@@ -10,26 +10,26 @@ |
||
10 | 10 | interface CommandHandlerManagerInterface |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * !!! IMPORTANT !!! |
|
15 | - * If overriding the default CommandHandler for a Command, |
|
16 | - * be sure to also override CommandHandler::verify(), |
|
17 | - * or else an Exception will be thrown when the CommandBus |
|
18 | - * attempts to verify that the incoming Command matches the Handler |
|
19 | - * |
|
20 | - * @param CommandHandlerInterface $command_handler |
|
21 | - * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
22 | - * @return void |
|
23 | - * @throws InvalidCommandHandlerException |
|
24 | - */ |
|
25 | - public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
13 | + /** |
|
14 | + * !!! IMPORTANT !!! |
|
15 | + * If overriding the default CommandHandler for a Command, |
|
16 | + * be sure to also override CommandHandler::verify(), |
|
17 | + * or else an Exception will be thrown when the CommandBus |
|
18 | + * attempts to verify that the incoming Command matches the Handler |
|
19 | + * |
|
20 | + * @param CommandHandlerInterface $command_handler |
|
21 | + * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
22 | + * @return void |
|
23 | + * @throws InvalidCommandHandlerException |
|
24 | + */ |
|
25 | + public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @param CommandInterface $command |
|
31 | - * @param CommandBusInterface $command_bus |
|
32 | - * @return mixed |
|
33 | - */ |
|
34 | - public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
29 | + /** |
|
30 | + * @param CommandInterface $command |
|
31 | + * @param CommandBusInterface $command_bus |
|
32 | + * @return mixed |
|
33 | + */ |
|
34 | + public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
35 | 35 | } |
@@ -23,36 +23,36 @@ |
||
23 | 23 | { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
28 | - */ |
|
29 | - private $cancel_ticket_line_item_service; |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * Command constructor |
|
34 | - * |
|
35 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
36 | - */ |
|
37 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
38 | - { |
|
39 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @param CommandInterface|CancelTicketLineItemCommand $command |
|
45 | - * @return mixed |
|
46 | - * @throws InvalidEntityException |
|
47 | - * @throws RuntimeException |
|
48 | - */ |
|
49 | - public function handle(CommandInterface $command) |
|
50 | - { |
|
51 | - return $this->cancel_ticket_line_item_service->cancel( |
|
52 | - $command->transaction(), |
|
53 | - $command->ticket(), |
|
54 | - $command->quantity(), |
|
55 | - $command->ticketLineItem() |
|
56 | - ); |
|
57 | - } |
|
26 | + /** |
|
27 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
28 | + */ |
|
29 | + private $cancel_ticket_line_item_service; |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * Command constructor |
|
34 | + * |
|
35 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
36 | + */ |
|
37 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
38 | + { |
|
39 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @param CommandInterface|CancelTicketLineItemCommand $command |
|
45 | + * @return mixed |
|
46 | + * @throws InvalidEntityException |
|
47 | + * @throws RuntimeException |
|
48 | + */ |
|
49 | + public function handle(CommandInterface $command) |
|
50 | + { |
|
51 | + return $this->cancel_ticket_line_item_service->cancel( |
|
52 | + $command->transaction(), |
|
53 | + $command->ticket(), |
|
54 | + $command->quantity(), |
|
55 | + $command->ticketLineItem() |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | } |
@@ -22,37 +22,37 @@ |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * @var CreateTicketLineItemService $factory |
|
27 | - */ |
|
28 | - private $factory; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * Command constructor |
|
33 | - * |
|
34 | - * @param CreateTicketLineItemService $factory |
|
35 | - */ |
|
36 | - public function __construct(CreateTicketLineItemService $factory) |
|
37 | - { |
|
38 | - $this->factory = $factory; |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @param CommandInterface|CreateTicketLineItemCommand $command |
|
44 | - * @return EE_Line_Item |
|
45 | - * @throws InvalidEntityException |
|
46 | - * @throws UnexpectedEntityException |
|
47 | - * @throws EE_Error |
|
48 | - */ |
|
49 | - public function handle(CommandInterface $command) |
|
50 | - { |
|
51 | - // create new line item for ticket |
|
52 | - return $this->factory->create( |
|
53 | - $command->transaction(), |
|
54 | - $command->ticket(), |
|
55 | - $command->quantity() |
|
56 | - ); |
|
57 | - } |
|
25 | + /** |
|
26 | + * @var CreateTicketLineItemService $factory |
|
27 | + */ |
|
28 | + private $factory; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * Command constructor |
|
33 | + * |
|
34 | + * @param CreateTicketLineItemService $factory |
|
35 | + */ |
|
36 | + public function __construct(CreateTicketLineItemService $factory) |
|
37 | + { |
|
38 | + $this->factory = $factory; |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @param CommandInterface|CreateTicketLineItemCommand $command |
|
44 | + * @return EE_Line_Item |
|
45 | + * @throws InvalidEntityException |
|
46 | + * @throws UnexpectedEntityException |
|
47 | + * @throws EE_Error |
|
48 | + */ |
|
49 | + public function handle(CommandInterface $command) |
|
50 | + { |
|
51 | + // create new line item for ticket |
|
52 | + return $this->factory->create( |
|
53 | + $command->transaction(), |
|
54 | + $command->ticket(), |
|
55 | + $command->quantity() |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | } |
@@ -21,134 +21,134 @@ |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * @var EEM_Attendee $attendee_model |
|
26 | - */ |
|
27 | - protected $attendee_model; |
|
24 | + /** |
|
25 | + * @var EEM_Attendee $attendee_model |
|
26 | + */ |
|
27 | + protected $attendee_model; |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @param EEM_Attendee $attendee_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Attendee $attendee_model) |
|
34 | - { |
|
35 | - $this->attendee_model = $attendee_model; |
|
36 | - } |
|
30 | + /** |
|
31 | + * @param EEM_Attendee $attendee_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Attendee $attendee_model) |
|
34 | + { |
|
35 | + $this->attendee_model = $attendee_model; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @param CommandInterface|CreateAttendeeCommand $command |
|
41 | - * @return EE_Attendee |
|
42 | - * @throws EE_Error |
|
43 | - * @throws InvalidEntityException |
|
44 | - */ |
|
45 | - public function handle(CommandInterface $command) |
|
46 | - { |
|
47 | - // have we met before? |
|
48 | - $attendee = $this->findExistingAttendee( |
|
49 | - $command->registration(), |
|
50 | - $command->attendeeDetails() |
|
51 | - ); |
|
52 | - // did we find an already existing record for this attendee ? |
|
53 | - if ($attendee instanceof EE_Attendee) { |
|
54 | - $attendee = $this->updateExistingAttendeeData( |
|
55 | - $attendee, |
|
56 | - $command->attendeeDetails() |
|
57 | - ); |
|
58 | - } else { |
|
59 | - $attendee = $this->createNewAttendee( |
|
60 | - $command->registration(), |
|
61 | - $command->attendeeDetails() |
|
62 | - ); |
|
63 | - } |
|
64 | - return $attendee; |
|
65 | - } |
|
39 | + /** |
|
40 | + * @param CommandInterface|CreateAttendeeCommand $command |
|
41 | + * @return EE_Attendee |
|
42 | + * @throws EE_Error |
|
43 | + * @throws InvalidEntityException |
|
44 | + */ |
|
45 | + public function handle(CommandInterface $command) |
|
46 | + { |
|
47 | + // have we met before? |
|
48 | + $attendee = $this->findExistingAttendee( |
|
49 | + $command->registration(), |
|
50 | + $command->attendeeDetails() |
|
51 | + ); |
|
52 | + // did we find an already existing record for this attendee ? |
|
53 | + if ($attendee instanceof EE_Attendee) { |
|
54 | + $attendee = $this->updateExistingAttendeeData( |
|
55 | + $attendee, |
|
56 | + $command->attendeeDetails() |
|
57 | + ); |
|
58 | + } else { |
|
59 | + $attendee = $this->createNewAttendee( |
|
60 | + $command->registration(), |
|
61 | + $command->attendeeDetails() |
|
62 | + ); |
|
63 | + } |
|
64 | + return $attendee; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * find_existing_attendee |
|
70 | - * |
|
71 | - * @param EE_Registration $registration |
|
72 | - * @param array $attendee_data |
|
73 | - * @return EE_Attendee |
|
74 | - */ |
|
75 | - private function findExistingAttendee(EE_Registration $registration, array $attendee_data) |
|
76 | - { |
|
77 | - $existing_attendee = null; |
|
78 | - // does this attendee already exist in the db ? |
|
79 | - // we're searching using a combination of first name, last name, AND email address |
|
80 | - $ATT_fname = ! empty($attendee_data['ATT_fname']) |
|
81 | - ? $attendee_data['ATT_fname'] |
|
82 | - : ''; |
|
83 | - $ATT_lname = ! empty($attendee_data['ATT_lname']) |
|
84 | - ? $attendee_data['ATT_lname'] |
|
85 | - : ''; |
|
86 | - $ATT_email = ! empty($attendee_data['ATT_email']) |
|
87 | - ? $attendee_data['ATT_email'] |
|
88 | - : ''; |
|
89 | - // but only if those have values |
|
90 | - if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
91 | - $existing_attendee = $this->attendee_model->find_existing_attendee( |
|
92 | - array( |
|
93 | - 'ATT_fname' => $ATT_fname, |
|
94 | - 'ATT_lname' => $ATT_lname, |
|
95 | - 'ATT_email' => $ATT_email, |
|
96 | - ) |
|
97 | - ); |
|
98 | - } |
|
99 | - return apply_filters( |
|
100 | - 'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
|
101 | - $existing_attendee, |
|
102 | - $registration, |
|
103 | - $attendee_data |
|
104 | - ); |
|
105 | - } |
|
68 | + /** |
|
69 | + * find_existing_attendee |
|
70 | + * |
|
71 | + * @param EE_Registration $registration |
|
72 | + * @param array $attendee_data |
|
73 | + * @return EE_Attendee |
|
74 | + */ |
|
75 | + private function findExistingAttendee(EE_Registration $registration, array $attendee_data) |
|
76 | + { |
|
77 | + $existing_attendee = null; |
|
78 | + // does this attendee already exist in the db ? |
|
79 | + // we're searching using a combination of first name, last name, AND email address |
|
80 | + $ATT_fname = ! empty($attendee_data['ATT_fname']) |
|
81 | + ? $attendee_data['ATT_fname'] |
|
82 | + : ''; |
|
83 | + $ATT_lname = ! empty($attendee_data['ATT_lname']) |
|
84 | + ? $attendee_data['ATT_lname'] |
|
85 | + : ''; |
|
86 | + $ATT_email = ! empty($attendee_data['ATT_email']) |
|
87 | + ? $attendee_data['ATT_email'] |
|
88 | + : ''; |
|
89 | + // but only if those have values |
|
90 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
91 | + $existing_attendee = $this->attendee_model->find_existing_attendee( |
|
92 | + array( |
|
93 | + 'ATT_fname' => $ATT_fname, |
|
94 | + 'ATT_lname' => $ATT_lname, |
|
95 | + 'ATT_email' => $ATT_email, |
|
96 | + ) |
|
97 | + ); |
|
98 | + } |
|
99 | + return apply_filters( |
|
100 | + 'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
|
101 | + $existing_attendee, |
|
102 | + $registration, |
|
103 | + $attendee_data |
|
104 | + ); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * _update_existing_attendee_data |
|
110 | - * in case it has changed since last time they registered for an event |
|
111 | - * |
|
112 | - * @param EE_Attendee $existing_attendee |
|
113 | - * @param array $attendee_data |
|
114 | - * @return EE_Attendee |
|
115 | - * @throws EE_Error |
|
116 | - */ |
|
117 | - private function updateExistingAttendeeData(EE_Attendee $existing_attendee, array $attendee_data) |
|
118 | - { |
|
119 | - // first remove fname, lname, and email from attendee data |
|
120 | - // because these properties will be exactly the same as the returned attendee object, |
|
121 | - // since they were used in the query to get the attendee object in the first place |
|
122 | - $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
123 | - // now loop thru what's left and add to attendee CPT |
|
124 | - foreach ($attendee_data as $property_name => $property_value) { |
|
125 | - if (! in_array($property_name, $dont_set, true) |
|
126 | - && $this->attendee_model->has_field($property_name) |
|
127 | - ) { |
|
128 | - $existing_attendee->set($property_name, $property_value); |
|
129 | - } |
|
130 | - } |
|
131 | - // better save that now |
|
132 | - $existing_attendee->save(); |
|
133 | - return $existing_attendee; |
|
134 | - } |
|
108 | + /** |
|
109 | + * _update_existing_attendee_data |
|
110 | + * in case it has changed since last time they registered for an event |
|
111 | + * |
|
112 | + * @param EE_Attendee $existing_attendee |
|
113 | + * @param array $attendee_data |
|
114 | + * @return EE_Attendee |
|
115 | + * @throws EE_Error |
|
116 | + */ |
|
117 | + private function updateExistingAttendeeData(EE_Attendee $existing_attendee, array $attendee_data) |
|
118 | + { |
|
119 | + // first remove fname, lname, and email from attendee data |
|
120 | + // because these properties will be exactly the same as the returned attendee object, |
|
121 | + // since they were used in the query to get the attendee object in the first place |
|
122 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
123 | + // now loop thru what's left and add to attendee CPT |
|
124 | + foreach ($attendee_data as $property_name => $property_value) { |
|
125 | + if (! in_array($property_name, $dont_set, true) |
|
126 | + && $this->attendee_model->has_field($property_name) |
|
127 | + ) { |
|
128 | + $existing_attendee->set($property_name, $property_value); |
|
129 | + } |
|
130 | + } |
|
131 | + // better save that now |
|
132 | + $existing_attendee->save(); |
|
133 | + return $existing_attendee; |
|
134 | + } |
|
135 | 135 | |
136 | 136 | |
137 | - /** |
|
138 | - * create_new_attendee |
|
139 | - * |
|
140 | - * @param EE_Registration $registration |
|
141 | - * @param array $attendee_data |
|
142 | - * @return EE_Attendee |
|
143 | - * @throws EE_Error |
|
144 | - */ |
|
145 | - private function createNewAttendee(EE_Registration $registration, array $attendee_data) |
|
146 | - { |
|
147 | - // create new attendee object |
|
148 | - $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
149 | - // set author to event creator |
|
150 | - $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
151 | - $new_attendee->save(); |
|
152 | - return $new_attendee; |
|
153 | - } |
|
137 | + /** |
|
138 | + * create_new_attendee |
|
139 | + * |
|
140 | + * @param EE_Registration $registration |
|
141 | + * @param array $attendee_data |
|
142 | + * @return EE_Attendee |
|
143 | + * @throws EE_Error |
|
144 | + */ |
|
145 | + private function createNewAttendee(EE_Registration $registration, array $attendee_data) |
|
146 | + { |
|
147 | + // create new attendee object |
|
148 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
149 | + // set author to event creator |
|
150 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
151 | + $new_attendee->save(); |
|
152 | + return $new_attendee; |
|
153 | + } |
|
154 | 154 | } |
@@ -122,7 +122,7 @@ |
||
122 | 122 | $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
123 | 123 | // now loop thru what's left and add to attendee CPT |
124 | 124 | foreach ($attendee_data as $property_name => $property_value) { |
125 | - if (! in_array($property_name, $dont_set, true) |
|
125 | + if ( ! in_array($property_name, $dont_set, true) |
|
126 | 126 | && $this->attendee_model->has_field($property_name) |
127 | 127 | ) { |
128 | 128 | $existing_attendee->set($property_name, $property_value); |
@@ -19,31 +19,31 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * @var UpdateRegistrationService $update_registration_service |
|
24 | - */ |
|
25 | - private $update_registration_service; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * Command constructor |
|
30 | - * |
|
31 | - * @param UpdateRegistrationService $update_registration_service |
|
32 | - */ |
|
33 | - public function __construct( |
|
34 | - UpdateRegistrationService $update_registration_service |
|
35 | - ) { |
|
36 | - $this->update_registration_service = $update_registration_service; |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command |
|
42 | - * @return boolean |
|
43 | - * @throws InvalidEntityException |
|
44 | - */ |
|
45 | - public function handle(CommandInterface $command) |
|
46 | - { |
|
47 | - return $this->update_registration_service->updateRegistrationAndTransaction($command->registration()); |
|
48 | - } |
|
22 | + /** |
|
23 | + * @var UpdateRegistrationService $update_registration_service |
|
24 | + */ |
|
25 | + private $update_registration_service; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * Command constructor |
|
30 | + * |
|
31 | + * @param UpdateRegistrationService $update_registration_service |
|
32 | + */ |
|
33 | + public function __construct( |
|
34 | + UpdateRegistrationService $update_registration_service |
|
35 | + ) { |
|
36 | + $this->update_registration_service = $update_registration_service; |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command |
|
42 | + * @return boolean |
|
43 | + * @throws InvalidEntityException |
|
44 | + */ |
|
45 | + public function handle(CommandInterface $command) |
|
46 | + { |
|
47 | + return $this->update_registration_service->updateRegistrationAndTransaction($command->registration()); |
|
48 | + } |
|
49 | 49 | } |
@@ -23,35 +23,35 @@ |
||
23 | 23 | { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @var CopyRegistrationService $copy_registration_service |
|
28 | - */ |
|
29 | - private $copy_registration_service; |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * Command constructor |
|
34 | - * |
|
35 | - * @param CopyRegistrationService $copy_registration_service |
|
36 | - */ |
|
37 | - public function __construct(CopyRegistrationService $copy_registration_service) |
|
38 | - { |
|
39 | - $this->copy_registration_service = $copy_registration_service; |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @param CommandInterface|CopyRegistrationPaymentsCommand $command |
|
45 | - * @return boolean |
|
46 | - * @throws EE_Error |
|
47 | - * @throws UnexpectedEntityException |
|
48 | - * @throws RuntimeException |
|
49 | - */ |
|
50 | - public function handle(CommandInterface $command) |
|
51 | - { |
|
52 | - return $this->copy_registration_service->copyPaymentDetails( |
|
53 | - $command->targetRegistration(), |
|
54 | - $command->registrationToCopy() |
|
55 | - ); |
|
56 | - } |
|
26 | + /** |
|
27 | + * @var CopyRegistrationService $copy_registration_service |
|
28 | + */ |
|
29 | + private $copy_registration_service; |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * Command constructor |
|
34 | + * |
|
35 | + * @param CopyRegistrationService $copy_registration_service |
|
36 | + */ |
|
37 | + public function __construct(CopyRegistrationService $copy_registration_service) |
|
38 | + { |
|
39 | + $this->copy_registration_service = $copy_registration_service; |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @param CommandInterface|CopyRegistrationPaymentsCommand $command |
|
45 | + * @return boolean |
|
46 | + * @throws EE_Error |
|
47 | + * @throws UnexpectedEntityException |
|
48 | + * @throws RuntimeException |
|
49 | + */ |
|
50 | + public function handle(CommandInterface $command) |
|
51 | + { |
|
52 | + return $this->copy_registration_service->copyPaymentDetails( |
|
53 | + $command->targetRegistration(), |
|
54 | + $command->registrationToCopy() |
|
55 | + ); |
|
56 | + } |
|
57 | 57 | } |
@@ -28,43 +28,43 @@ |
||
28 | 28 | { |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
33 | - */ |
|
34 | - private $cancel_ticket_line_item_service; |
|
31 | + /** |
|
32 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
33 | + */ |
|
34 | + private $cancel_ticket_line_item_service; |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * Command constructor |
|
39 | - * |
|
40 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
41 | - */ |
|
42 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
43 | - { |
|
44 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
45 | - } |
|
37 | + /** |
|
38 | + * Command constructor |
|
39 | + * |
|
40 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
41 | + */ |
|
42 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
43 | + { |
|
44 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command |
|
50 | - * @return boolean |
|
51 | - * @throws DomainException |
|
52 | - * @throws EE_Error |
|
53 | - * @throws EntityNotFoundException |
|
54 | - * @throws InvalidDataTypeException |
|
55 | - * @throws InvalidInterfaceException |
|
56 | - * @throws UnexpectedEntityException |
|
57 | - * @throws InvalidArgumentException |
|
58 | - * @throws ReflectionException |
|
59 | - * @throws RuntimeException |
|
60 | - */ |
|
61 | - public function handle(CommandInterface $command) |
|
62 | - { |
|
63 | - $registration = $command->registration(); |
|
64 | - $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
65 | - // cancel original registration |
|
66 | - $registration->set_status(EEM_Registration::status_id_cancelled); |
|
67 | - $registration->save(); |
|
68 | - return true; |
|
69 | - } |
|
48 | + /** |
|
49 | + * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command |
|
50 | + * @return boolean |
|
51 | + * @throws DomainException |
|
52 | + * @throws EE_Error |
|
53 | + * @throws EntityNotFoundException |
|
54 | + * @throws InvalidDataTypeException |
|
55 | + * @throws InvalidInterfaceException |
|
56 | + * @throws UnexpectedEntityException |
|
57 | + * @throws InvalidArgumentException |
|
58 | + * @throws ReflectionException |
|
59 | + * @throws RuntimeException |
|
60 | + */ |
|
61 | + public function handle(CommandInterface $command) |
|
62 | + { |
|
63 | + $registration = $command->registration(); |
|
64 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
65 | + // cancel original registration |
|
66 | + $registration->set_status(EEM_Registration::status_id_cancelled); |
|
67 | + $registration->save(); |
|
68 | + return true; |
|
69 | + } |
|
70 | 70 | } |
@@ -24,37 +24,37 @@ |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @var CopyRegistrationService $copy_registration_service |
|
29 | - */ |
|
30 | - private $copy_registration_service; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Command constructor |
|
35 | - * |
|
36 | - * @param CopyRegistrationService $copy_registration_service |
|
37 | - */ |
|
38 | - public function __construct(CopyRegistrationService $copy_registration_service) |
|
39 | - { |
|
40 | - $this->copy_registration_service = $copy_registration_service; |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * @param CommandInterface|CopyRegistrationDetailsCommand $command |
|
46 | - * @return boolean |
|
47 | - * @throws InvalidEntityException |
|
48 | - * @throws EE_Error |
|
49 | - * @throws EntityNotFoundException |
|
50 | - * @throws UnexpectedEntityException |
|
51 | - * @throws RuntimeException |
|
52 | - */ |
|
53 | - public function handle(CommandInterface $command) |
|
54 | - { |
|
55 | - return $this->copy_registration_service->copyRegistrationDetails( |
|
56 | - $command->targetRegistration(), |
|
57 | - $command->registrationToCopy() |
|
58 | - ); |
|
59 | - } |
|
27 | + /** |
|
28 | + * @var CopyRegistrationService $copy_registration_service |
|
29 | + */ |
|
30 | + private $copy_registration_service; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Command constructor |
|
35 | + * |
|
36 | + * @param CopyRegistrationService $copy_registration_service |
|
37 | + */ |
|
38 | + public function __construct(CopyRegistrationService $copy_registration_service) |
|
39 | + { |
|
40 | + $this->copy_registration_service = $copy_registration_service; |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * @param CommandInterface|CopyRegistrationDetailsCommand $command |
|
46 | + * @return boolean |
|
47 | + * @throws InvalidEntityException |
|
48 | + * @throws EE_Error |
|
49 | + * @throws EntityNotFoundException |
|
50 | + * @throws UnexpectedEntityException |
|
51 | + * @throws RuntimeException |
|
52 | + */ |
|
53 | + public function handle(CommandInterface $command) |
|
54 | + { |
|
55 | + return $this->copy_registration_service->copyRegistrationDetails( |
|
56 | + $command->targetRegistration(), |
|
57 | + $command->registrationToCopy() |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | } |