10
10
11
11
use Magento \Framework \App \ResourceConnection ;
12
12
use Magento \Framework \DB \Ddl \Trigger ;
13
+ use Magento \Framework \DB \Ddl \TriggerFactory ;
14
+ use Magento \Framework \Mview \ViewInterface ;
13
15
14
16
class Subscription implements SubscriptionInterface
15
17
{
@@ -21,12 +23,12 @@ class Subscription implements SubscriptionInterface
21
23
protected $ connection ;
22
24
23
25
/**
24
- * @var \Magento\Framework\DB\Ddl\ TriggerFactory
26
+ * @var TriggerFactory
25
27
*/
26
28
protected $ triggerFactory ;
27
29
28
30
/**
29
- * @var \Magento\Framework\Mview\View\ CollectionInterface
31
+ * @var CollectionInterface
30
32
*/
31
33
protected $ viewCollection ;
32
34
@@ -67,21 +69,21 @@ class Subscription implements SubscriptionInterface
67
69
68
70
/**
69
71
* @param ResourceConnection $resource
70
- * @param \Magento\Framework\DB\Ddl\ TriggerFactory $triggerFactory
71
- * @param \Magento\Framework\Mview\View\ CollectionInterface $viewCollection
72
- * @param \Magento\Framework\Mview\ ViewInterface $view
72
+ * @param TriggerFactory $triggerFactory
73
+ * @param CollectionInterface $viewCollection
74
+ * @param ViewInterface $view
73
75
* @param string $tableName
74
76
* @param string $columnName
75
77
* @param array $ignoredUpdateColumns
76
78
*/
77
79
public function __construct (
78
80
ResourceConnection $ resource ,
79
- \ Magento \ Framework \ DB \ Ddl \ TriggerFactory $ triggerFactory ,
80
- \ Magento \ Framework \ Mview \ View \ CollectionInterface $ viewCollection ,
81
- \ Magento \ Framework \ Mview \ ViewInterface $ view ,
81
+ TriggerFactory $ triggerFactory ,
82
+ CollectionInterface $ viewCollection ,
83
+ ViewInterface $ view ,
82
84
$ tableName ,
83
85
$ columnName ,
84
- $ ignoredUpdateColumns = []
86
+ array $ ignoredUpdateColumns = []
85
87
) {
86
88
$ this ->connection = $ resource ->getConnection ();
87
89
$ this ->triggerFactory = $ triggerFactory ;
@@ -94,9 +96,9 @@ public function __construct(
94
96
}
95
97
96
98
/**
97
- * Create subsciption
99
+ * Create subscription
98
100
*
99
- * @return \Magento\Framework\Mview\View\ SubscriptionInterface
101
+ * @return SubscriptionInterface
100
102
*/
101
103
public function create ()
102
104
{
@@ -113,7 +115,7 @@ public function create()
113
115
114
116
// Add statements for linked views
115
117
foreach ($ this ->getLinkedViews () as $ view ) {
116
- /** @var \Magento\Framework\Mview\ ViewInterface $view */
118
+ /** @var ViewInterface $view */
117
119
$ trigger ->addStatement ($ this ->buildStatement ($ event , $ view ->getChangelog ()));
118
120
}
119
121
@@ -127,7 +129,7 @@ public function create()
127
129
/**
128
130
* Remove subscription
129
131
*
130
- * @return \Magento\Framework\Mview\View\ SubscriptionInterface
132
+ * @return SubscriptionInterface
131
133
*/
132
134
public function remove ()
133
135
{
@@ -142,7 +144,7 @@ public function remove()
142
144
143
145
// Add statements for linked views
144
146
foreach ($ this ->getLinkedViews () as $ view ) {
145
- /** @var \Magento\Framework\Mview\ ViewInterface $view */
147
+ /** @var ViewInterface $view */
146
148
$ trigger ->addStatement ($ this ->buildStatement ($ event , $ view ->getChangelog ()));
147
149
}
148
150
@@ -165,10 +167,10 @@ public function remove()
165
167
protected function getLinkedViews ()
166
168
{
167
169
if (!$ this ->linkedViews ) {
168
- $ viewList = $ this ->viewCollection ->getViewsByStateMode (\ Magento \ Framework \ Mview \ View \ StateInterface::MODE_ENABLED );
170
+ $ viewList = $ this ->viewCollection ->getViewsByStateMode (StateInterface::MODE_ENABLED );
169
171
170
172
foreach ($ viewList as $ view ) {
171
- /** @var \Magento\Framework\Mview\ ViewInterface $view */
173
+ /** @var ViewInterface $view */
172
174
// Skip the current view
173
175
if ($ view ->getId () == $ this ->getView ()->getId ()) {
174
176
continue ;
@@ -189,10 +191,10 @@ protected function getLinkedViews()
189
191
* Build trigger statement for INSERT, UPDATE, DELETE events
190
192
*
191
193
* @param string $event
192
- * @param \Magento\Framework\Mview\View\ ChangelogInterface $changelog
194
+ * @param ChangelogInterface $changelog
193
195
* @return string
194
196
*/
195
- protected function buildStatement ($ event , $ changelog )
197
+ protected function buildStatement (string $ event , ChangelogInterface $ changelog )
196
198
{
197
199
switch ($ event ) {
198
200
case Trigger::EVENT_INSERT :
@@ -259,7 +261,7 @@ private function getAfterEventTriggerName($event)
259
261
/**
260
262
* Retrieve View related to subscription
261
263
*
262
- * @return \Magento\Framework\Mview\ ViewInterface
264
+ * @return ViewInterface
263
265
* @codeCoverageIgnore
264
266
*/
265
267
public function getView ()
0 commit comments