14
14
use Magento \Framework \EntityManager \MetadataPool ;
15
15
use Magento \Framework \Exception \CouldNotDeleteException ;
16
16
use 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 ;
21
18
22
19
/**
23
20
* Class responsibly for persistence of prices.
@@ -76,21 +73,7 @@ class PricePersistence
76
73
private $ itemsPerOperation = 500 ;
77
74
78
75
/**
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.
94
77
*
95
78
* @var DateTime
96
79
*/
@@ -104,8 +87,6 @@ class PricePersistence
104
87
* @param ProductIdLocatorInterface $productIdLocator
105
88
* @param MetadataPool $metadataPool
106
89
* @param string $attributeCode
107
- * @param Action|null $productAction
108
- * @param CoreDate|null $coreDate
109
90
* @param DateTime|null $dateTime
110
91
*/
111
92
public function __construct (
@@ -114,19 +95,13 @@ public function __construct(
114
95
ProductIdLocatorInterface $ productIdLocator ,
115
96
MetadataPool $ metadataPool ,
116
97
$ attributeCode = '' ,
117
- ?Action $ productAction = null ,
118
- ?CoreDate $ coreDate = null ,
119
98
?DateTime $ dateTime = null
120
99
) {
121
100
$ this ->attributeResource = $ attributeResource ;
122
101
$ this ->attributeRepository = $ attributeRepository ;
123
102
$ this ->attributeCode = $ attributeCode ;
124
103
$ this ->productIdLocator = $ productIdLocator ;
125
104
$ this ->metadataPool = $ metadataPool ;
126
- $ this ->productAction = $ productAction ?: ObjectManager::getInstance ()
127
- ->get (Action::class);
128
- $ this ->coreDate = $ coreDate ?: ObjectManager::getInstance ()
129
- ->get (CoreDate::class);
130
105
$ this ->dateTime = $ dateTime ?: ObjectManager::getInstance ()
131
106
->get (DateTime::class);
132
107
}
@@ -283,10 +258,10 @@ public function getEntityLinkField()
283
258
public function updateLastUpdatedAt (array $ productIds ): void
284
259
{
285
260
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 ]
290
265
);
291
266
} catch (\Exception $ e ) {
292
267
throw new CouldNotSaveException (
0 commit comments