File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
lib/internal/Magento/Framework/Mview Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -61,9 +61,11 @@ public function unsubscribe(): void
61
61
}
62
62
63
63
// Unsubscribe old views that still have triggers in db
64
- $ triggerTableNames = $ this ->getTriggerTableNames ();
64
+ $ triggerTableNames = $ this ->getTableNamesWithTriggers ();
65
65
foreach ($ triggerTableNames as $ tableName ) {
66
- $ this ->createViewByTableName ($ tableName )->unsubscribe ();
66
+ $ view = $ this ->createViewByTableName ($ tableName );
67
+ $ view ->unsubscribe ();
68
+ $ view ->getState ()->delete ();
67
69
}
68
70
69
71
// Re-subscribe mviews
@@ -74,11 +76,11 @@ public function unsubscribe(): void
74
76
}
75
77
76
78
/**
77
- * Retrieve trigger table name list
78
- *
79
- * @return array
80
- */
81
- private function getTriggerTableNames (): array
79
+ * Retrieve list of table names that have triggers
80
+ *
81
+ * @return array
82
+ */
83
+ private function getTableNamesWithTriggers (): array
82
84
{
83
85
$ connection = $ this ->resource ->getConnection ();
84
86
$ dbName = $ this ->resource ->getSchemaName (ResourceConnection::DEFAULT_CONNECTION );
@@ -106,11 +108,11 @@ private function createViewByTableName(string $tableName): ViewInterface
106
108
'subscription_model ' => null
107
109
];
108
110
$ data ['data ' ] = [
109
- 'id ' => '0 ' ,
110
111
'subscriptions ' => $ subscription ,
111
112
];
112
113
113
114
$ view = $ this ->viewFactory ->create ($ data );
115
+ $ view ->setId ('old_view ' );
114
116
$ view ->getState ()->setMode (StateInterface::MODE_ENABLED );
115
117
116
118
return $ view ;
You can’t perform that action at this time.
0 commit comments