@@ -117,8 +117,19 @@ public function create()
117
117
118
118
// Add statements for linked views
119
119
foreach ($ this ->getLinkedViews () as $ view ) {
120
+ // Store current column name for reverting back later.
121
+ $ originalColumnName = $ this ->getColumnName ();
122
+
120
123
/** @var \Magento\Framework\Mview\ViewInterface $view */
124
+ // Use the column name from specific subscription instead of
125
+ // use from the one which is currently updated.
126
+ $ subscriptions = $ view ->getSubscriptions ();
127
+ $ subscription = $ subscriptions [$ this ->getTableName ()];
128
+ $ this ->columnName = $ subscription ['column ' ];
121
129
$ trigger ->addStatement ($ this ->buildStatement ($ event , $ view ->getChangelog ()));
130
+
131
+ // Revert back the column name.
132
+ $ this ->columnName = $ originalColumnName ;
122
133
}
123
134
124
135
$ this ->connection ->dropTrigger ($ trigger ->getName ());
@@ -146,8 +157,19 @@ public function remove()
146
157
147
158
// Add statements for linked views
148
159
foreach ($ this ->getLinkedViews () as $ view ) {
160
+ // Store current column name for reverting back later.
161
+ $ originalColumnName = $ this ->columnName ;
162
+
149
163
/** @var \Magento\Framework\Mview\ViewInterface $view */
164
+ // Use the column name from specific subscription instead of
165
+ // use from the one which is currently updated.
166
+ $ subscriptions = $ view ->getSubscriptions ();
167
+ $ subscription = $ subscriptions [$ this ->getTableName ()];
168
+ $ this ->columnName = $ subscription ['column ' ];
150
169
$ trigger ->addStatement ($ this ->buildStatement ($ event , $ view ->getChangelog ()));
170
+
171
+ // Revert back the column name.
172
+ $ this ->columnName = $ originalColumnName ;
151
173
}
152
174
153
175
$ this ->connection ->dropTrigger ($ trigger ->getName ());
0 commit comments