6 declare(strict_types=1);
21 private $baseFinalPrice;
26 private $indexTableStructureFactory;
31 private $tableMaintainer;
41 private $basePriceModifier;
52 IndexTableStructureFactory $indexTableStructureFactory,
57 $this->baseFinalPrice = $baseFinalPrice;
58 $this->indexTableStructureFactory = $indexTableStructureFactory;
59 $this->tableMaintainer = $tableMaintainer;
60 $this->productType = $productType;
61 $this->basePriceModifier = $basePriceModifier;
69 $this->tableMaintainer->createMainTmpTable($dimensions);
71 $temporaryPriceTable = $this->indexTableStructureFactory->create([
72 'tableName' => $this->tableMaintainer->getMainTmpTable($dimensions),
73 'entityField' =>
'entity_id',
74 'customerGroupField' =>
'customer_group_id',
75 'websiteField' =>
'website_id',
76 'taxClassField' =>
'tax_class_id',
77 'originalPriceField' =>
'price',
78 'finalPriceField' =>
'final_price',
79 'minPriceField' =>
'min_price',
80 'maxPriceField' =>
'max_price',
81 'tierPriceField' =>
'tier_price',
83 $select = $this->baseFinalPrice->getQuery($dimensions, $this->productType, iterator_to_array($entityIds));
84 $query =
$select->insertFromSelect($temporaryPriceTable->getTableName(), [],
false);
85 $this->tableMaintainer->getConnection()->query(
$query);
87 $this->basePriceModifier->modifyPrice($temporaryPriceTable, iterator_to_array($entityIds));
executeByDimensions(array $dimensions, \Traversable $entityIds)
__construct(BaseFinalPrice $baseFinalPrice, IndexTableStructureFactory $indexTableStructureFactory, TableMaintainer $tableMaintainer, BasePriceModifier $basePriceModifier, $productType=\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)