Skip to content

Commit e3ab318

Browse files
committed
MC-37719: [API] cataloginventory_stock should perform reindex while creating a link to bundle product.
1 parent b2dc3ec commit e3ab318

File tree

4 files changed

+10
-63
lines changed

4 files changed

+10
-63
lines changed

app/code/Magento/Bundle/Plugin/Api/ProductLinkManagement/ReindexAfterSaveChildPlugin.php renamed to app/code/Magento/Bundle/Plugin/Api/ProductLinkManagement/ReindexAfterAddChildBySkuPlugin.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
use Magento\Catalog\Model\Indexer\Product\Full;
1414

1515
/**
16-
* Reindex bundle product after child has been updated.
16+
* Reindex bundle product after child has been added.
1717
*/
18-
class ReindexAfterSaveChildPlugin
18+
class ReindexAfterAddChildBySkuPlugin
1919
{
2020
/**
2121
* @var Full
@@ -38,19 +38,19 @@ public function __construct(Full $indexer, ProductRepositoryInterface $productRe
3838
}
3939

4040
/**
41-
* Reindex bundle product after child has been updated.
41+
* Reindex bundle product after child has been added.
4242
*
4343
* @param ProductLinkManagementInterface $subject
44-
* @param bool $result
44+
* @param int $result
4545
* @param string $sku
46-
* @return bool
46+
* @return int
4747
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4848
*/
49-
public function afterSaveChild(
49+
public function afterAddChildByProductSku(
5050
ProductLinkManagementInterface $subject,
51-
bool $result,
51+
int $result,
5252
string $sku
53-
): bool {
53+
): int {
5454
$bundleProduct = $this->productRepository->get($sku, true);
5555
$this->indexer->executeRow($bundleProduct->getId());
5656

app/code/Magento/Bundle/Plugin/Api/ProductLinkManagement/ReindexAfterAddChildPlugin.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

app/code/Magento/Bundle/etc/webapi_rest/di.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
</arguments>
1515
</type>
1616
<type name="Magento\Bundle\Api\ProductLinkManagementInterface">
17-
<plugin name="reindex_after_add_child" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterAddChildPlugin"/>
18-
<plugin name="reindex_after_save_child" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterSaveChildPlugin"/>
17+
<plugin name="reindex_after_add_child_by_sku" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterAddChildBySkuPlugin"/>
1918
<plugin name="reindex_after_remove_child" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterRemoveChildPlugin"/>
2019
</type>
2120
</config>

app/code/Magento/Bundle/etc/webapi_soap/di.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
</arguments>
1515
</type>
1616
<type name="Magento\Bundle\Api\ProductLinkManagementInterface">
17-
<plugin name="reindex_after_add_child" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterAddChildPlugin"/>
18-
<plugin name="reindex_after_save_child" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterSaveChildPlugin"/>
17+
<plugin name="reindex_after_add_child_by_sku" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterAddChildBySkuPlugin"/>
1918
<plugin name="reindex_after_remove_child" type="Magento\Bundle\Plugin\Api\ProductLinkManagement\ReindexAfterRemoveChildPlugin"/>
2019
</type>
2120
</config>

0 commit comments

Comments
 (0)