|
11 | 11 | use Magento\Framework\App\ResourceConnection;
|
12 | 12 | use Magento\Framework\App\State as AppState;
|
13 | 13 | use Magento\Framework\DB\Ddl\Trigger;
|
14 |
| -use Magento\Framework\Mview\View\CollectionInterface as ViewCollection; |
| 14 | +use Magento\Framework\Mview\View\CollectionFactory as ViewCollectionFactory; |
15 | 15 | use Magento\Framework\Mview\View\StateInterface;
|
16 | 16 | use Magento\Framework\Setup\ConsoleLogger;
|
17 | 17 | use Magento\Framework\Setup\Declaration\Schema\DryRunLogger;
|
@@ -57,29 +57,29 @@ class UpgradeCommand extends AbstractSetupCommand
|
57 | 57 | private $searchConfigFactory;
|
58 | 58 |
|
59 | 59 | /*
|
60 |
| - * @var ViewCollection |
| 60 | + * @var ViewCollectionFactory |
61 | 61 | */
|
62 |
| - private $viewCollection; |
| 62 | + private $viewCollectionFactory; |
63 | 63 |
|
64 | 64 | /**
|
65 | 65 | * @param InstallerFactory $installerFactory
|
66 | 66 | * @param SearchConfigFactory $searchConfigFactory
|
67 | 67 | * @param DeploymentConfig $deploymentConfig
|
68 | 68 | * @param AppState|null $appState
|
69 |
| - * @param ViewCollection|null $viewCollection |
| 69 | + * @param ViewCollectionFactory|null $viewCollectionFactory |
70 | 70 | */
|
71 | 71 | public function __construct(
|
72 | 72 | InstallerFactory $installerFactory,
|
73 | 73 | SearchConfigFactory $searchConfigFactory,
|
74 | 74 | DeploymentConfig $deploymentConfig = null,
|
75 | 75 | AppState $appState = null,
|
76 |
| - ViewCollection $viewCollection = null |
| 76 | + ViewCollectionFactory $viewCollectionFactory = null |
77 | 77 | ) {
|
78 | 78 | $this->installerFactory = $installerFactory;
|
79 | 79 | $this->searchConfigFactory = $searchConfigFactory;
|
80 | 80 | $this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
|
81 | 81 | $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); |
83 | 83 | parent::__construct();
|
84 | 84 | }
|
85 | 85 |
|
@@ -179,14 +179,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
|
179 | 179 | private function removeUnusedTriggers()
|
180 | 180 | {
|
181 | 181 | // unsubscribe mview
|
182 |
| - $viewList = $this->viewCollection->getViewsByStateMode(StateInterface::MODE_ENABLED); |
| 182 | + $viewCollection = $this->viewCollectionFactory->create(); |
| 183 | + $viewList = $viewCollection->getViewsByStateMode(StateInterface::MODE_ENABLED); |
183 | 184 | foreach ($viewList as $view) {
|
184 | 185 | /** @var \Magento\Framework\Mview\ViewInterface $view */
|
185 | 186 | $view->unsubscribe();
|
186 | 187 | }
|
187 | 188 |
|
188 | 189 | // remove extra triggers that have correct naming structure
|
189 |
| - /* @var ResourceConnection $resource */ |
| 190 | + /** @var ResourceConnection $resource */ |
190 | 191 | $resource = ObjectManager::getInstance()->get(ResourceConnection::class);
|
191 | 192 | $connection = $resource->getConnection();
|
192 | 193 | $triggers = $connection->getTriggers();
|
|
0 commit comments