19
19
use App \Model \Enums \ApplicationState ;
20
20
use App \Model \Enums \PaymentType ;
21
21
use App \Model \Enums \SkautIsEventType ;
22
- use App \Model \Settings \Exceptions \SettingsException ;
22
+ use App \Model \Settings \Exceptions \SettingsItemNotFoundException ;
23
+ use App \Model \Settings \Queries \SettingIntValueQuery ;
24
+ use App \Model \Settings \Queries \SettingStringValueQuery ;
23
25
use App \Model \Settings \Settings ;
24
26
use App \Model \User \Repositories \UserRepository ;
25
27
use App \Model \User \User ;
26
28
use App \Services \AclService ;
27
29
use App \Services \ApplicationService ;
28
30
use App \Services \ExcelExportService ;
29
- use App \Services \ISettingsService ;
31
+ use App \Services \QueryBus ;
30
32
use App \Services \SkautIsEventEducationService ;
31
33
use App \Services \SkautIsEventGeneralService ;
32
34
use App \Services \SubeventService ;
60
62
*/
61
63
class UsersGridControl extends Control
62
64
{
65
+ private QueryBus $ queryBus ;
66
+
63
67
private ITranslator $ translator ;
64
68
65
69
private EntityManagerInterface $ em ;
66
70
67
71
private UserRepository $ userRepository ;
68
72
69
- private ISettingsService $ settingsService ;
70
-
71
73
private CustomInputRepository $ customInputRepository ;
72
74
73
75
private RoleRepository $ roleRepository ;
@@ -91,10 +93,10 @@ class UsersGridControl extends Control
91
93
private SubeventService $ subeventService ;
92
94
93
95
public function __construct (
96
+ QueryBus $ queryBus ,
94
97
ITranslator $ translator ,
95
98
EntityManagerInterface $ em ,
96
99
UserRepository $ userRepository ,
97
- ISettingsService $ settingsService ,
98
100
CustomInputRepository $ customInputRepository ,
99
101
RoleRepository $ roleRepository ,
100
102
ExcelExportService $ excelExportService ,
@@ -106,10 +108,10 @@ public function __construct(
106
108
SkautIsEventGeneralService $ skautIsEventGeneralService ,
107
109
SubeventService $ subeventService
108
110
) {
111
+ $ this ->queryBus = $ queryBus ;
109
112
$ this ->translator = $ translator ;
110
113
$ this ->em = $ em ;
111
114
$ this ->userRepository = $ userRepository ;
112
- $ this ->settingsService = $ settingsService ;
113
115
$ this ->customInputRepository = $ customInputRepository ;
114
116
$ this ->roleRepository = $ roleRepository ;
115
117
$ this ->excelExportService = $ excelExportService ;
@@ -136,7 +138,7 @@ public function render(): void
136
138
/**
137
139
* Vytvoří komponentu.
138
140
*
139
- * @throws SettingsException
141
+ * @throws SettingsItemNotFoundException
140
142
* @throws Throwable
141
143
* @throws DataGridColumnStatusException
142
144
* @throws DataGridException
@@ -166,7 +168,7 @@ public function createComponentUsersGrid(string $name): DataGrid
166
168
$ grid ->addGroupAction ('admin.users.users_group_action_mark_paid_today ' , $ this ->preparePaymentMethodOptionsWithoutEmpty ())
167
169
->onSelect [] = [$ this , 'groupMarkPaidToday ' ];
168
170
169
- switch ($ this ->settingsService -> getValue ( Settings::SKAUTIS_EVENT_TYPE )) {
171
+ switch ($ this ->queryBus -> handle ( new SettingStringValueQuery ( Settings::SKAUTIS_EVENT_TYPE ) )) {
170
172
case SkautIsEventType::GENERAL :
171
173
$ grid ->addGroupAction ('admin.users.users_group_action_insert_into_skaut_is ' )
172
174
->onSelect [] = [$ this , 'groupInsertIntoSkautIs ' ];
@@ -699,14 +701,14 @@ public function groupInsertIntoSkautIs(array $ids, bool $accept): void
699
701
700
702
$ p = $ this ->getPresenter ();
701
703
702
- $ eventId = $ this ->settingsService -> getIntValue ( Settings::SKAUTIS_EVENT_ID );
704
+ $ eventId = $ this ->queryBus -> handle ( new SettingIntValueQuery ( Settings::SKAUTIS_EVENT_ID ) );
703
705
704
706
if ($ eventId === null ) {
705
707
$ p ->flashMessage ('admin.users.users_group_action_insert_into_skaut_is_error_not_connected ' , 'danger ' );
706
708
$ this ->redirect ('this ' );
707
709
}
708
710
709
- switch ($ this ->settingsService -> getValue ( Settings::SKAUTIS_EVENT_TYPE )) {
711
+ switch ($ this ->queryBus -> handle ( new SettingStringValueQuery ( Settings::SKAUTIS_EVENT_TYPE ) )) {
710
712
case SkautIsEventType::GENERAL :
711
713
$ skautIsEventService = $ this ->skautIsEventGeneralService ;
712
714
break ;
0 commit comments