6 declare(strict_types=1);
22 private $moduleDataSetup;
32 $this->moduleDataSetup = $moduleDataSetup;
40 $this->moduleDataSetup->startSetup();
41 $setup = $this->moduleDataSetup;
43 $catalogCategoryProductIndexColumns = array_keys(
44 $setup->getConnection()->describeTable(
$setup->getTable(
'catalog_category_product_index'))
46 $storeSelect =
$setup->getConnection()->select()->from(
$setup->getTable(
'store'))->where(
'store_id > 0');
47 foreach (
$setup->getConnection()->fetchAll($storeSelect) as
$store) {
48 $catalogCategoryProductIndexSelect =
$setup->getConnection()->select()
50 $setup->getTable(
'catalog_category_product_index')
55 $indexTable =
$setup->getTable(
'catalog_category_product_index') .
59 $setup->getConnection()->query(
60 $setup->getConnection()->insertFromSelect(
61 $catalogCategoryProductIndexSelect,
63 $catalogCategoryProductIndexColumns,
68 $setup->getConnection()->delete(
$setup->getTable(
'catalog_category_product_index'));
69 $setup->getConnection()->delete(
$setup->getTable(
'catalog_category_product_index_replica'));
70 $setup->getConnection()->delete(
$setup->getTable(
'catalog_category_product_index_tmp'));
72 $this->moduleDataSetup->endSetup();
__construct(ModuleDataSetupInterface $moduleDataSetup)
const INSERT_ON_DUPLICATE