|
6 | 6 | namespace Magento\Catalog\Cron; |
7 | 7 |
|
8 | 8 | use Magento\Catalog\Api\Data\CategoryInterface; |
9 | | -use Magento\Framework\App\ObjectManager; |
10 | 9 | use Magento\Framework\App\ResourceConnection; |
11 | 10 | use Magento\Framework\EntityManager\MetadataPool; |
12 | 11 |
|
@@ -59,21 +58,24 @@ class RefreshSpecialPrices |
59 | 58 | * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate |
60 | 59 | * @param \Magento\Eav\Model\Config $eavConfig |
61 | 60 | * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor |
| 61 | + * @param MetadataPool $metadataPool |
62 | 62 | */ |
63 | 63 | public function __construct( |
64 | 64 | \Magento\Store\Model\StoreManagerInterface $storeManager, |
65 | 65 | ResourceConnection $resource, |
66 | 66 | \Magento\Framework\Stdlib\DateTime $dateTime, |
67 | 67 | \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, |
68 | 68 | \Magento\Eav\Model\Config $eavConfig, |
69 | | - \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor |
| 69 | + \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor, |
| 70 | + MetadataPool $metadataPool |
70 | 71 | ) { |
71 | 72 | $this->_storeManager = $storeManager; |
72 | 73 | $this->_resource = $resource; |
73 | 74 | $this->_dateTime = $dateTime; |
74 | 75 | $this->_localeDate = $localeDate; |
75 | 76 | $this->_eavConfig = $eavConfig; |
76 | 77 | $this->_processor = $processor; |
| 78 | + $this->metadataPool = $metadataPool; |
77 | 79 | } |
78 | 80 |
|
79 | 81 | /** |
@@ -139,8 +141,8 @@ protected function _refreshSpecialPriceByStore($storeId, $attrCode, $attrConditi |
139 | 141 | $attribute = $this->_eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attrCode); |
140 | 142 | $attributeId = $attribute->getAttributeId(); |
141 | 143 |
|
142 | | - $linkField = $this->getMetadataPool()->getMetadata(CategoryInterface::class)->getLinkField(); |
143 | | - $identifierField = $this->getMetadataPool()->getMetadata(CategoryInterface::class)->getIdentifierField(); |
| 144 | + $linkField = $this->metadataPool->getMetadata(CategoryInterface::class)->getLinkField(); |
| 145 | + $identifierField = $this->metadataPool->getMetadata(CategoryInterface::class)->getIdentifierField(); |
144 | 146 |
|
145 | 147 | $connection = $this->_getConnection(); |
146 | 148 |
|
@@ -170,18 +172,4 @@ protected function _refreshSpecialPriceByStore($storeId, $attrCode, $attrConditi |
170 | 172 | $this->_processor->getIndexer()->reindexList($selectData); |
171 | 173 | } |
172 | 174 | } |
173 | | - |
174 | | - /** |
175 | | - * Get MetadataPool instance |
176 | | - * @return MetadataPool |
177 | | - * |
178 | | - * @deprecated 101.0.0 |
179 | | - */ |
180 | | - private function getMetadataPool() |
181 | | - { |
182 | | - if (null === $this->metadataPool) { |
183 | | - $this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); |
184 | | - } |
185 | | - return $this->metadataPool; |
186 | | - } |
187 | 175 | } |
0 commit comments