Skip to content

Commit 4b0f7ed

Browse files
MC-32014: Remove google-shopping-ads module from core in 2.4.1
1 parent f1f9ce7 commit 4b0f7ed

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

setup/src/Magento/Setup/Console/Command/UpgradeCommand.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\App\ResourceConnection;
1212
use Magento\Framework\App\State as AppState;
1313
use Magento\Framework\DB\Ddl\Trigger;
14-
use Magento\Framework\Mview\View\CollectionInterface as ViewCollection;
14+
use Magento\Framework\Mview\View\CollectionFactory as ViewCollectionFactory;
1515
use Magento\Framework\Mview\View\StateInterface;
1616
use Magento\Framework\Setup\ConsoleLogger;
1717
use Magento\Framework\Setup\Declaration\Schema\DryRunLogger;
@@ -57,29 +57,29 @@ class UpgradeCommand extends AbstractSetupCommand
5757
private $searchConfigFactory;
5858

5959
/*
60-
* @var ViewCollection
60+
* @var ViewCollectionFactory
6161
*/
62-
private $viewCollection;
62+
private $viewCollectionFactory;
6363

6464
/**
6565
* @param InstallerFactory $installerFactory
6666
* @param SearchConfigFactory $searchConfigFactory
6767
* @param DeploymentConfig $deploymentConfig
6868
* @param AppState|null $appState
69-
* @param ViewCollection|null $viewCollection
69+
* @param ViewCollectionFactory|null $viewCollectionFactory
7070
*/
7171
public function __construct(
7272
InstallerFactory $installerFactory,
7373
SearchConfigFactory $searchConfigFactory,
7474
DeploymentConfig $deploymentConfig = null,
7575
AppState $appState = null,
76-
ViewCollection $viewCollection = null
76+
ViewCollectionFactory $viewCollectionFactory = null
7777
) {
7878
$this->installerFactory = $installerFactory;
7979
$this->searchConfigFactory = $searchConfigFactory;
8080
$this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
8181
$this->appState = $appState ?: ObjectManager::getInstance()->get(AppState::class);
82-
$this->viewCollection = $viewCollection ?: ObjectManager::getInstance()->get(ViewCollection::class);
82+
$this->viewCollectionFactory = $viewCollectionFactory ?: ObjectManager::getInstance()->get(ViewCollectionFactory::class);
8383
parent::__construct();
8484
}
8585

@@ -179,14 +179,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
179179
private function removeUnusedTriggers()
180180
{
181181
// unsubscribe mview
182-
$viewList = $this->viewCollection->getViewsByStateMode(StateInterface::MODE_ENABLED);
182+
$viewCollection = $this->viewCollectionFactory->create();
183+
$viewList = $viewCollection->getViewsByStateMode(StateInterface::MODE_ENABLED);
183184
foreach ($viewList as $view) {
184185
/** @var \Magento\Framework\Mview\ViewInterface $view */
185186
$view->unsubscribe();
186187
}
187188

188189
// remove extra triggers that have correct naming structure
189-
/* @var ResourceConnection $resource */
190+
/** @var ResourceConnection $resource */
190191
$resource = ObjectManager::getInstance()->get(ResourceConnection::class);
191192
$connection = $resource->getConnection();
192193
$triggers = $connection->getTriggers();

0 commit comments

Comments
 (0)