1414use Magento \Framework \EntityManager \MetadataPool ;
1515use Magento \Framework \Exception \CouldNotDeleteException ;
1616use Magento \Framework \Exception \CouldNotSaveException ;
17- use Magento \Catalog \Model \Product \Action ;
18- use Magento \Framework \Stdlib \DateTime \DateTime as CoreDate ;
19- use Magento \Framework \Stdlib \DateTime ;
20- use Magento \Store \Model \Store ;
17+ use Magento \Framework \Stdlib \DateTime \DateTime ;
2118
2219/**
2320 * Class responsibly for persistence of prices.
@@ -76,21 +73,7 @@ class PricePersistence
7673 private $ itemsPerOperation = 500 ;
7774
7875 /**
79- * Product action property to update the attributes.
80- *
81- * @var Action
82- */
83- private $ productAction ;
84-
85- /**
86- * Core Date to get the gm date.
87- *
88- * @var CoreDate
89- */
90- private $ coreDate ;
91-
92- /**
93- * Date time property to format the date.
76+ * Date time property to get the gm date.
9477 *
9578 * @var DateTime
9679 */
@@ -104,8 +87,6 @@ class PricePersistence
10487 * @param ProductIdLocatorInterface $productIdLocator
10588 * @param MetadataPool $metadataPool
10689 * @param string $attributeCode
107- * @param Action|null $productAction
108- * @param CoreDate|null $coreDate
10990 * @param DateTime|null $dateTime
11091 */
11192 public function __construct (
@@ -114,19 +95,13 @@ public function __construct(
11495 ProductIdLocatorInterface $ productIdLocator ,
11596 MetadataPool $ metadataPool ,
11697 $ attributeCode = '' ,
117- ?Action $ productAction = null ,
118- ?CoreDate $ coreDate = null ,
11998 ?DateTime $ dateTime = null
12099 ) {
121100 $ this ->attributeResource = $ attributeResource ;
122101 $ this ->attributeRepository = $ attributeRepository ;
123102 $ this ->attributeCode = $ attributeCode ;
124103 $ this ->productIdLocator = $ productIdLocator ;
125104 $ this ->metadataPool = $ metadataPool ;
126- $ this ->productAction = $ productAction ?: ObjectManager::getInstance ()
127- ->get (Action::class);
128- $ this ->coreDate = $ coreDate ?: ObjectManager::getInstance ()
129- ->get (CoreDate::class);
130105 $ this ->dateTime = $ dateTime ?: ObjectManager::getInstance ()
131106 ->get (DateTime::class);
132107 }
@@ -283,10 +258,10 @@ public function getEntityLinkField()
283258 public function updateLastUpdatedAt (array $ productIds ): void
284259 {
285260 try {
286- $ this ->productAction -> updateAttributes (
287- $ productIds ,
288- [ProductInterface::UPDATED_AT => $ this ->dateTime ->formatDate ( $ this -> coreDate -> gmtDate () )],
289- Store:: DEFAULT_STORE_ID
261+ $ this ->attributeResource -> getConnection ()-> update (
262+ $ this -> attributeResource -> getTable ( ' catalog_product_entity ' ) ,
263+ [ProductInterface::UPDATED_AT => $ this ->dateTime ->gmtDate ()],
264+ [ ' entity_id IN(?) ' => $ productIds ]
290265 );
291266 } catch (\Exception $ e ) {
292267 throw new CouldNotSaveException (
0 commit comments