|
10 | 10 | use Magento\Framework\EntityManager\MetadataPool; |
11 | 11 | use Magento\Catalog\Model\Product\Attribute\Source\Status; |
12 | 12 | use Magento\Bundle\Model\ResourceModel\Selection as BundleSelection; |
13 | | -use Magento\Store\Model\Store; |
14 | 13 | use Magento\Store\Model\StoreManagerInterface; |
15 | 14 | use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory; |
16 | 15 | use Magento\Catalog\Model\Product; |
@@ -83,6 +82,7 @@ public function __construct( |
83 | 82 | * @param int $bundleId |
84 | 83 | * @param int|null $websiteId |
85 | 84 | * @return array |
| 85 | + * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
86 | 86 | */ |
87 | 87 | public function getChildProductIds(int $bundleId, ?int $websiteId = null): array |
88 | 88 | { |
@@ -130,10 +130,11 @@ private function getProducts(array $selectionProductIds, int $websiteId): array |
130 | 130 | { |
131 | 131 | $productIds = []; |
132 | 132 | $defaultStore = $this->storeManager->getWebsite($websiteId)->getDefaultStore(); |
133 | | - $defaultStoreId = $defaultStore ? $defaultStore->getId() : Store::DEFAULT_STORE_ID; |
| 133 | + $defaultStoreId = $defaultStore ? $defaultStore->getId() : null; |
134 | 134 | foreach ($selectionProductIds as $optionProductIds) { |
135 | | - $productIds = array_merge($productIds, $optionProductIds); |
| 135 | + $productIds[] = $optionProductIds; |
136 | 136 | } |
| 137 | + $productIds = array_merge([], ...$productIds); |
137 | 138 | $productCollection = $this->productCollectionFactory->create(); |
138 | 139 | $productCollection->joinAttribute( |
139 | 140 | ProductInterface::STATUS, |
|
0 commit comments