Skip to content

Commit 9577bf8

Browse files
committed
ACP2E-2837: Product entity updated_at column values not updating while updating price through REST API
- Fixed the static test failure.
1 parent f542536 commit 9577bf8

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
/**
2323
* Class responsibly for persistence of prices.
24+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2425
*/
2526
class PricePersistence
2627
{
@@ -47,49 +48,49 @@ class PricePersistence
4748
private $productIdLocator;
4849

4950
/**
50-
* Metadata pool.
51+
* Metadata pool property to get a metadata.
5152
*
5253
* @var MetadataPool
5354
*/
5455
private $metadataPool;
5556

5657
/**
57-
* Attribute code.
58+
* Attribute code attribute to get the attribute id.
5859
*
5960
* @var string
6061
*/
6162
private $attributeCode;
6263

6364
/**
64-
* Attribute ID.
65+
* Attribute ID property to store the attribute id.
6566
*
6667
* @var int
6768
*/
6869
private $attributeId;
6970

7071
/**
71-
* Items per operation.
72+
* Items per operation to chunk the array in a batch.
7273
*
7374
* @var int
7475
*/
7576
private $itemsPerOperation = 500;
7677

7778
/**
78-
* Product Action.
79+
* Product action property to update the attributes.
7980
*
8081
* @var Action
8182
*/
8283
private $productAction;
8384

8485
/**
85-
* Product Action.
86+
* Core Date to get the gm date.
8687
*
8788
* @var CoreDate
8889
*/
8990
private $coreDate;
9091

9192
/**
92-
* Product Action.
93+
* Date time property to format the date.
9394
*
9495
* @var DateTime
9596
*/
@@ -124,9 +125,9 @@ public function __construct(
124125
$this->metadataPool = $metadataPool;
125126
$this->productAction = $productAction ?: ObjectManager::getInstance()
126127
->get(Action::class);
127-
$this->coreDate = $productAction ?: ObjectManager::getInstance()
128+
$this->coreDate = $coreDate ?: ObjectManager::getInstance()
128129
->get(CoreDate::class);
129-
$this->dateTime = $productAction ?: ObjectManager::getInstance()
130+
$this->dateTime = $dateTime ?: ObjectManager::getInstance()
130131
->get(DateTime::class);
131132
}
132133

@@ -284,8 +285,8 @@ public function updateLastUpdatedAt(array $productIds): void
284285
try {
285286
$this->productAction->updateAttributes(
286287
$productIds,
287-
[ProductInterface::UPDATED_AT => $this->dateTime->formatDate($this->coreDate->gmtDate())]
288-
,Store::DEFAULT_STORE_ID
288+
[ProductInterface::UPDATED_AT => $this->dateTime->formatDate($this->coreDate->gmtDate())],
289+
Store::DEFAULT_STORE_ID
289290
);
290291
} catch (\Exception $e) {
291292
throw new CouldNotSaveException(

0 commit comments

Comments
 (0)