diff --git a/vendor/magento/module-catalog/Cron/RefreshSpecialPrices.php b/vendor/magento/module-catalog/Cron/RefreshSpecialPrices.php index 25668e57e40e..61d731dc4ad0 100644 --- a/vendor/magento/module-catalog/Cron/RefreshSpecialPrices.php +++ b/vendor/magento/module-catalog/Cron/RefreshSpecialPrices.php @@ -6,7 +6,6 @@ namespace Magento\Catalog\Cron; use Magento\Catalog\Api\Data\CategoryInterface; -use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ResourceConnection; use Magento\Framework\EntityManager\MetadataPool; @@ -59,6 +58,7 @@ class RefreshSpecialPrices * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor + * @param MetadataPool $metadataPool */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -66,7 +66,8 @@ public function __construct( \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Eav\Model\Config $eavConfig, - \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor + \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor, + MetadataPool $metadataPool ) { $this->_storeManager = $storeManager; $this->_resource = $resource; @@ -74,6 +75,7 @@ public function __construct( $this->_localeDate = $localeDate; $this->_eavConfig = $eavConfig; $this->_processor = $processor; + $this->metadataPool = $metadataPool; } /** @@ -139,8 +141,8 @@ protected function _refreshSpecialPriceByStore($storeId, $attrCode, $attrConditi $attribute = $this->_eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attrCode); $attributeId = $attribute->getAttributeId(); - $linkField = $this->getMetadataPool()->getMetadata(CategoryInterface::class)->getLinkField(); - $identifierField = $this->getMetadataPool()->getMetadata(CategoryInterface::class)->getIdentifierField(); + $linkField = $this->metadataPool->getMetadata(CategoryInterface::class)->getLinkField(); + $identifierField = $this->metadataPool->getMetadata(CategoryInterface::class)->getIdentifierField(); $connection = $this->_getConnection(); @@ -164,24 +166,10 @@ protected function _refreshSpecialPriceByStore($storeId, $attrCode, $attrConditi $attrConditionValue ); - $selectData = $connection->fetchCol($select, $identifierField); + $selectData = $connection->fetchCol($select); if (!empty($selectData)) { $this->_processor->getIndexer()->reindexList($selectData); } } - - /** - * Get MetadataPool instance - * @return MetadataPool - * - * @deprecated 101.0.0 - */ - private function getMetadataPool() - { - if (null === $this->metadataPool) { - $this->metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); - } - return $this->metadataPool; - } }