|
12 | 12 | use Magento\Framework\Indexer\ActionInterface; |
13 | 13 | use Magento\ConfigurableProduct\Api\Data\OptionInterface; |
14 | 14 | use Magento\Catalog\Api\Data\ProductAttributeInterface; |
| 15 | +use Magento\Framework\App\ObjectManager; |
15 | 16 |
|
16 | 17 | /** |
17 | 18 | * Plugin product resource model |
@@ -55,15 +56,18 @@ class Product |
55 | 56 | public function __construct( |
56 | 57 | Configurable $configurable, |
57 | 58 | ActionInterface $productIndexer, |
58 | | - ProductAttributeRepositoryInterface $productAttributeRepository, |
59 | | - \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, |
60 | | - \Magento\Framework\Api\FilterBuilder $filterBuilder |
| 59 | + ProductAttributeRepositoryInterface $productAttributeRepository = null, |
| 60 | + \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder = null, |
| 61 | + \Magento\Framework\Api\FilterBuilder $filterBuilder = null |
61 | 62 | ) { |
62 | 63 | $this->configurable = $configurable; |
63 | 64 | $this->productIndexer = $productIndexer; |
64 | | - $this->productAttributeRepository = $productAttributeRepository; |
65 | | - $this->searchCriteriaBuilder = $searchCriteriaBuilder; |
66 | | - $this->filterBuilder = $filterBuilder; |
| 65 | + $this->productAttributeRepository = $productAttributeRepository ?: ObjectManager::getInstance() |
| 66 | + ->get(ProductAttributeRepositoryInterface::class); |
| 67 | + $this->searchCriteriaBuilder = $searchCriteriaBuilder ?: ObjectManager::getInstance() |
| 68 | + ->get(\Magento\Framework\Api\SearchCriteriaBuilder::class); |
| 69 | + $this->filterBuilder = $filterBuilder ?: ObjectManager::getInstance() |
| 70 | + ->get(\Magento\Framework\Api\FilterBuilder::class); |
67 | 71 | } |
68 | 72 |
|
69 | 73 | /** |
|
0 commit comments