26 private $activeTableSwitcher;
31 private $tableSwapper;
41 TableSwapper $tableSwapper =
null 44 $this->activeTableSwitcher = $activeTableSwitcher;
45 $this->tableSwapper = $tableSwapper ??
62 $useAdditionalTable =
false 64 if (!
$rule->getIsActive() || empty(
$rule->getWebsiteIds())) {
74 \Magento\Framework\Profiler::start(
'__MATCH_PRODUCTS__');
76 \Magento\Framework\Profiler::stop(
'__MATCH_PRODUCTS__');
78 $indexTable = $this->resource->getTableName(
'catalogrule_product');
79 if ($useAdditionalTable) {
80 $indexTable = $this->resource->getTableName(
81 $this->tableSwapper->getWorkingTableName(
'catalogrule_product')
86 $customerGroupIds =
$rule->getCustomerGroupIds();
87 $fromTime = strtotime(
$rule->getFromDate());
88 $toTime = strtotime(
$rule->getToDate());
90 $sortOrder = (int)
$rule->getSortOrder();
91 $actionOperator =
$rule->getSimpleAction();
92 $actionAmount =
$rule->getDiscountAmount();
93 $actionStop =
$rule->getStopRulesProcessing();
102 foreach ($customerGroupIds as $customerGroupId) {
105 'from_time' => $fromTime,
106 'to_time' => $toTime,
108 'customer_group_id' => $customerGroupId,
110 'action_operator' => $actionOperator,
111 'action_amount' => $actionAmount,
112 'action_stop' => $actionStop,
113 'sort_order' => $sortOrder,
116 if (count($rows) == $batchCount) {
__construct(\Magento\Framework\App\ResourceConnection $resource, ActiveTableSwitcher $activeTableSwitcher, TableSwapper $tableSwapper=null)
execute(\Magento\CatalogRule\Model\Rule $rule, $batchCount, $useAdditionalTable=false)