Skip to content

Commit 8652bc8

Browse files
committed
- CR fix
1 parent fc1434b commit 8652bc8

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

app/code/Magento/Downloadable/Observer/UpdateLinkPurchasedObserver.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,33 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Downloadable\Observer;
89

910
use Magento\Framework\Event\ObserverInterface;
1011

1112
/**
12-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
13+
* Class UpdateLinkPurchasedObserver
14+
* Assign Downloadable links to customer created after issuing guest order.
1315
*/
1416
class UpdateLinkPurchasedObserver implements ObserverInterface
1517
{
1618
/**
1719
* Core store config
1820
* @var \Magento\Framework\App\Config\ScopeConfigInterface
1921
*/
20-
protected $_scopeConfig;
22+
private $scopeConfig;
2123

2224
/**
2325
* @var \Magento\Downloadable\Model\ResourceModel\Link\Purchased\CollectionFactory
2426
*/
25-
protected $_purchasedFactory;
27+
private $purchasedFactory;
2628

2729
/**
2830
* @var \Magento\Framework\DataObject\Copy
2931
*/
30-
protected $_objectCopyService;
32+
private $objectCopyService;
3133

3234
/**
3335
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@@ -39,9 +41,9 @@ public function __construct(
3941
\Magento\Downloadable\Model\ResourceModel\Link\Purchased\CollectionFactory $purchasedFactory,
4042
\Magento\Framework\DataObject\Copy $objectCopyService
4143
) {
42-
$this->_scopeConfig = $scopeConfig;
43-
$this->_purchasedFactory = $purchasedFactory;
44-
$this->_objectCopyService = $objectCopyService;
44+
$this->scopeConfig = $scopeConfig;
45+
$this->purchasedFactory = $purchasedFactory;
46+
$this->objectCopyService = $objectCopyService;
4547
}
4648

4749
/**
@@ -58,13 +60,13 @@ public function execute(\Magento\Framework\Event\Observer $observer)
5860
return $this;
5961
}
6062

61-
$purchasedLinks = $this->_createPurchasedCollection()->addFieldToFilter(
63+
$purchasedLinks = $this->purchasedFactory->create()->addFieldToFilter(
6264
'order_id',
6365
['eq' => $order->getId()]
6466
);
6567

6668
foreach ($purchasedLinks as $linkPurchased) {
67-
$this->_objectCopyService->copyFieldsetToTarget(
69+
$this->objectCopyService->copyFieldsetToTarget(
6870
\downloadable_sales_copy_order::class,
6971
'to_downloadable',
7072
$order,
@@ -75,12 +77,4 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7577

7678
return $this;
7779
}
78-
79-
/**
80-
* @return \Magento\Downloadable\Model\ResourceModel\Link\Purchased\Collection
81-
*/
82-
protected function _createPurchasedCollection()
83-
{
84-
return $this->_purchasedFactory->create();
85-
}
8680
}

0 commit comments

Comments
 (0)