Skip to content

Commit 7fe7858

Browse files
authored
MDEE-343: catalog_data_exporter_products table is not populated when product recommendations module is installed on an instance with price indexer dimensions (#207)
1 parent 8ab26b1 commit 7fe7858

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\CatalogDataExporter\Setup\Patch\Schema;
10+
11+
use Magento\Catalog\Model\Indexer\Product\Price\DimensionModeConfiguration;
12+
use Magento\Catalog\Model\Indexer\Product\Price\ModeSwitcherConfiguration;
13+
use Magento\CatalogDataExporter\Model\CreatePriceReadTable;
14+
use Magento\Framework\App\Config\MutableScopeConfigInterface;
15+
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
16+
use Magento\Framework\Setup\Patch\PatchInterface;
17+
18+
/**
19+
* Make read table for dimension
20+
*/
21+
class MakeReadTableForDimension implements SchemaPatchInterface
22+
{
23+
/**
24+
* @var MutableScopeConfigInterface
25+
*/
26+
private $scopeConfig;
27+
28+
/**
29+
* @var CreatePriceReadTable
30+
*/
31+
private $createDbView;
32+
33+
/**
34+
* @param MutableScopeConfigInterface $scopeConfig
35+
* @param CreatePriceReadTable $createDbView
36+
*/
37+
public function __construct(MutableScopeConfigInterface $scopeConfig, CreatePriceReadTable $createDbView)
38+
{
39+
$this->scopeConfig = $scopeConfig;
40+
$this->createDbView = $createDbView;
41+
}
42+
43+
44+
/**
45+
* @inheritDoc
46+
*/
47+
public function apply(): PatchInterface
48+
{
49+
$mode = $this->scopeConfig->getValue(ModeSwitcherConfiguration::XML_PATH_PRICE_DIMENSIONS_MODE);
50+
if ($mode !== DimensionModeConfiguration::DIMENSION_NONE) {
51+
$this->createDbView->createView($mode);
52+
}
53+
return $this;
54+
}
55+
56+
/**
57+
* @inheritDoc
58+
*/
59+
public static function getDependencies(): array
60+
{
61+
return [];
62+
}
63+
64+
/**
65+
* @inheritDoc
66+
*/
67+
public function getAliases(): array
68+
{
69+
return [];
70+
}
71+
}

0 commit comments

Comments
 (0)