Skip to content

Commit 98e0613

Browse files
committed
add constructor parameter
1 parent 3558184 commit 98e0613

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/code/Magento/Catalog/Model/CategoryLinkRepository.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ class CategoryLinkRepository implements \Magento\Catalog\Api\CategoryLinkReposit
2929
/**
3030
* @param \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository
3131
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
32+
* @param \Magento\Catalog\Model\ResourceModel\Product $productResource
3233
*/
3334
public function __construct(
3435
\Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
35-
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository
36+
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
37+
\Magento\Catalog\Model\ResourceModel\Product $productResource = null
3638
) {
3739
$this->categoryRepository = $categoryRepository;
3840
$this->productRepository = $productRepository;
39-
$this->productResource = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\ResourceModel\Product::class);
41+
$this->productResource = $productResource ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Model\ResourceModel\Product::class);
4042
}
4143

4244
/**

0 commit comments

Comments
 (0)