diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php index 6a2642a8568f488d8dd17a06584cfe7ca82b7ac8..ffd912a7cf3671d2137aebd7a7e476bc753c34ea 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php @@ -143,6 +143,7 @@ abstract class AbstractAction protected function processRelations($indexer, $ids, $onlyParents = false) { $parentIds = $indexer->getRelationsByChild($ids); + $parentIds = array_unique(array_merge($parentIds, $ids)); $childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds); return array_unique(array_merge($ids, $childIds, $parentIds)); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php index 58654136ab5a8d67cc586dd5a0b0756e4b5942f9..b621f1a4906d6594b6a7c68e27166ad97bf2ca24 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php @@ -129,8 +129,9 @@ class AbstractActionTest extends \PHPUnit\Framework\TestCase ->disableOriginalConstructor() ->getMock(); - $eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($childIds); - $eavSource->expects($this->once())->method('getRelationsByParent')->with($childIds)->willReturn($parentIds); + $eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($parentIds); + $eavSource->expects($this->once())->method('getRelationsByParent') + ->with(array_unique(array_merge($parentIds, $childIds)))->willReturn($parentIds); $eavDecimal->expects($this->once())->method('getRelationsByChild')->with($reindexIds)->willReturn($reindexIds); $eavDecimal->expects($this->once())->method('getRelationsByParent')->with($reindexIds)->willReturn([]);