Skip to content

Commit 68ca779

Browse files
committed
ACP2E-3493: Expired persistent quotes are not cleaned up by a cron job sales_clean_quotes
- Fixed the CR coments.
1 parent 22d1bc9 commit 68ca779

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

app/code/Magento/Persistent/Model/DeleteExpiredQuote.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ public function __construct(
3535
* Delete expired persistent quote for the website
3636
*
3737
* @param int|null $websiteId
38-
* @return $this
39-
* @throws NoSuchEntityException|LocalizedException
38+
* @return void
39+
* @throws LocalizedException
40+
* @throws NoSuchEntityException
4041
*/
41-
public function deleteExpiredQuote($websiteId = null): static
42+
public function deleteExpiredQuote(?int $websiteId): void
4243
{
4344
if ($websiteId === null) {
4445
$websiteId = $this->storeManager->getStore()->getWebsiteId();
@@ -59,7 +60,5 @@ public function deleteExpiredQuote($websiteId = null): static
5960
['store_id in (?)' => $storeIds, 'updated_at < ?' => $expiredBefore, 'is_persistent' => 1]
6061
);
6162
}
62-
63-
return $this;
6463
}
6564
}

app/code/Magento/Persistent/Observer/ClearExpiredCronJobObserver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ClearExpiredCronJobObserver
3333
*
3434
* @var DeleteExpiredQuoteFactory
3535
*/
36-
private DeleteExpiredQuoteFactory $deleteExpiredQuoteFactory;
36+
protected DeleteExpiredQuoteFactory $deleteExpiredQuoteFactory;
3737

3838
/**
3939
* @param CollectionFactory $websiteCollectionFactory
@@ -67,7 +67,7 @@ public function execute(Schedule $schedule)
6767
$deleteExpiredQuote = $this->deleteExpiredQuoteFactory->create();
6868
foreach ($websiteIds as $websiteId) {
6969
$this->_sessionFactory->create()->deleteExpired($websiteId);
70-
$deleteExpiredQuote->deleteExpiredQuote($websiteId);
70+
$deleteExpiredQuote->deleteExpiredQuote((int) $websiteId);
7171
}
7272

7373
return $this;

0 commit comments

Comments
 (0)