Skip to content

Commit ee09909

Browse files
MC-32014: Remove google-shopping-ads module from core in 2.4.1
1 parent 48748ce commit ee09909

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/internal/Magento/Framework/Mview/OldViews.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ public function unsubscribe(): void
6161
}
6262

6363
// Unsubscribe old views that still have triggers in db
64-
$triggerTableNames = $this->getTriggerTableNames();
64+
$triggerTableNames = $this->getTableNamesWithTriggers();
6565
foreach ($triggerTableNames as $tableName) {
66-
$this->createViewByTableName($tableName)->unsubscribe();
66+
$view = $this->createViewByTableName($tableName);
67+
$view->unsubscribe();
68+
$view->getState()->delete();
6769
}
6870

6971
// Re-subscribe mviews
@@ -74,11 +76,11 @@ public function unsubscribe(): void
7476
}
7577

7678
/**
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
8284
{
8385
$connection = $this->resource->getConnection();
8486
$dbName = $this->resource->getSchemaName(ResourceConnection::DEFAULT_CONNECTION);
@@ -106,11 +108,11 @@ private function createViewByTableName(string $tableName): ViewInterface
106108
'subscription_model' => null
107109
];
108110
$data['data'] = [
109-
'id' => '0',
110111
'subscriptions' => $subscription,
111112
];
112113

113114
$view = $this->viewFactory->create($data);
115+
$view->setId('old_view');
114116
$view->getState()->setMode(StateInterface::MODE_ENABLED);
115117

116118
return $view;

0 commit comments

Comments
 (0)