/**
  * @param \Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer $subject
  * @param \Closure $proceed
  * @param array $ids
  *
  * @return void
  */
 public function aroundExecuteList(\Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer $subject, \Closure $proceed, array $ids)
 {
     $configurableProductIds = $this->configurableProductsProvider->getIds($ids);
     $subProducts = $this->reindexSubProducts($configurableProductIds, $subject);
     $ids = array_diff($ids, $configurableProductIds, $subProducts);
     if ($ids) {
         $proceed($ids);
     }
 }
 /**
  * @param \Magento\CatalogRule\Model\Rule $rule
  * @param array $productIds
  * @return array
  */
 public function afterGetMatchingProductIds(\Magento\CatalogRule\Model\Rule $rule, array $productIds)
 {
     $configurableProductIds = $this->configurableProductsProvider->getIds(array_keys($productIds));
     foreach ($configurableProductIds as $productId) {
         $subProductsIds = $this->configurable->getChildrenIds($productId)[0];
         $parentValidationResult = $productIds[$productId];
         foreach ($subProductsIds as $subProductsId) {
             $productIds[$subProductsId] = $this->getSubProductValidationResult($rule->getId(), $subProductsId, $parentValidationResult);
         }
         unset($productIds[$productId]);
     }
     return $productIds;
 }
 /**
  * @param \Magento\CatalogRule\Model\Rule $rule
  * @param array $productIds
  * @return array
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterGetMatchingProductIds(\Magento\CatalogRule\Model\Rule $rule, array $productIds)
 {
     $configurableProductIds = $this->configurableProductsProvider->getIds(array_keys($productIds));
     foreach ($configurableProductIds as $productId) {
         if (!isset($this->childrenProducts[$productId])) {
             $this->childrenProducts[$productId] = $this->configurable->getChildrenIds($productId)[0];
         }
         $subProductIds = $this->childrenProducts[$productId];
         $parentValidationResult = isset($productIds[$productId]) ? array_filter($productIds[$productId]) : [];
         foreach ($subProductIds as $subProductId) {
             $childValidationResult = isset($productIds[$subProductId]) ? array_filter($productIds[$subProductId]) : [];
             $productIds[$subProductId] = $parentValidationResult + $childValidationResult;
         }
         unset($productIds[$productId]);
     }
     return $productIds;
 }