15
15
use Icinga \Web \Notification ;
16
16
use Icinga \Web \Widget \Tab ;
17
17
use Icinga \Web \Widget \Tabs ;
18
- use ipl \Sql \Connection ;
19
18
use ipl \Sql \Expression ;
20
19
use ipl \Stdlib \Filter ;
21
20
use ipl \Web \Compat \CompatController ;
@@ -30,22 +29,17 @@ class ChannelsController extends CompatController
30
29
{
31
30
use SearchControls;
32
31
33
- /** @var Connection */
34
- private $ db ;
35
-
36
32
/** @var Filter\Rule Filter from query string parameters */
37
33
private $ filter ;
38
34
39
- public function init ()
35
+ public function init (): void
40
36
{
41
37
$ this ->assertPermission ('config/modules ' );
42
-
43
- $ this ->db = Database::get ();
44
38
}
45
39
46
- public function indexAction ()
40
+ public function indexAction (): void
47
41
{
48
- $ channels = Channel::on ($ this -> db );
42
+ $ channels = Channel::on (Database:: get () );
49
43
$ this ->mergeTabs ($ this ->Module ()->getConfigTabs ());
50
44
$ this ->getTabs ()->activate ('channels ' );
51
45
@@ -95,7 +89,7 @@ public function indexAction()
95
89
))->setBaseTarget ('_next ' );
96
90
97
91
$ emptyStateMessage = null ;
98
- if (AvailableChannelType::on ($ this -> db )->columns ([new Expression ('1 ' )])->first () === null ) {
92
+ if (AvailableChannelType::on (Database:: get () )->columns ([new Expression ('1 ' )])->first () === null ) {
99
93
$ emptyStateMessage = t ('No channel types available. Make sure Icinga Notifications is running. ' );
100
94
$ addButton ->disable ($ emptyStateMessage );
101
95
}
@@ -112,10 +106,10 @@ public function indexAction()
112
106
}
113
107
}
114
108
115
- public function addAction ()
109
+ public function addAction (): void
116
110
{
117
111
$ this ->addTitleTab (t ('Add Channel ' ));
118
- $ form = (new ChannelForm ($ this -> db ))
112
+ $ form = (new ChannelForm (Database:: get () ))
119
113
->on (ChannelForm::ON_SUCCESS , function (ChannelForm $ form ) {
120
114
$ form ->addChannel ();
121
115
Notification::success (
@@ -142,7 +136,7 @@ public function completeAction(): void
142
136
public function searchEditorAction (): void
143
137
{
144
138
$ editor = $ this ->createSearchEditor (
145
- Channel::on ($ this -> db ),
139
+ Channel::on (Database:: get () ),
146
140
[
147
141
LimitControl::DEFAULT_LIMIT_PARAM ,
148
142
SortControl::DEFAULT_SORT_PARAM ,
0 commit comments