6 declare(strict_types=1);
30 private $priceTableResolver;
35 private $storeManager;
45 private $dimensionFactory;
50 private $dimensionModeConfiguration;
66 $this->priceTableResolver = $priceTableResolver;
68 $this->httpContext = $context;
69 $this->dimensionFactory = $dimensionFactory;
70 $this->dimensionModeConfiguration = $dimensionModeConfiguration;
89 &&
$tableName ===
'catalog_product_index_price' 90 && $this->dimensionModeConfiguration->getDimensionConfiguration()
92 return $this->priceTableResolver->resolve(
'catalog_product_index_price', $this->getDimensions());
102 private function getDimensions(): array
105 foreach ($this->dimensionModeConfiguration->getDimensionConfiguration() as $dimensionName) {
106 if ($dimensionName === WebsiteDimensionProvider::DIMENSION_NAME) {
107 $dimensions[] = $this->createDimensionFromWebsite();
109 if ($dimensionName === CustomerGroupDimensionProvider::DIMENSION_NAME) {
110 $dimensions[] = $this->createDimensionFromCustomerGroup();
121 private function createDimensionFromWebsite(): Dimension
124 return $this->dimensionFactory->create(
125 WebsiteDimensionProvider::DIMENSION_NAME,
126 (
string)$this->storeManager->getStore($storeKey)->getWebsiteId()
133 private function createDimensionFromCustomerGroup(): Dimension
135 return $this->dimensionFactory->create(
136 CustomerGroupDimensionProvider::DIMENSION_NAME,
137 (
string)$this->httpContext->getValue(CustomerContext::CONTEXT_GROUP)
__construct(IndexScopeResolverInterface $priceTableResolver, StoreManagerInterface $storeManager, Context $context, DimensionFactory $dimensionFactory, DimensionModeConfiguration $dimensionModeConfiguration)
afterGetTableName(ResourceConnection $subject, string $result, $tableName)