6
6
7
7
namespace Magento \Quote \Model \GuestCart ;
8
8
9
- use Magento \Authorization \Model \UserContextInterface ;
10
- use Magento \Framework \Event \ManagerInterface as EventManager ;
11
9
use Magento \Quote \Api \GuestCartManagementInterface ;
12
- use Magento \Quote \Model \CustomerManagement ;
13
- use Magento \Quote \Model \Quote as QuoteEntity ;
14
- use Magento \Quote \Model \Quote \Address \ToOrder as ToOrderConverter ;
15
- use Magento \Quote \Model \Quote \Address \ToOrderAddress as ToOrderAddressConverter ;
16
- use Magento \Quote \Model \Quote \Item \ToOrderItem as ToOrderItemConverter ;
17
- use Magento \Quote \Model \Quote \Payment \ToOrderPayment as ToOrderPaymentConverter ;
10
+ use Magento \Quote \Api \CartManagementInterface ;
18
11
use Magento \Quote \Model \QuoteIdMask ;
19
12
use Magento \Quote \Model \QuoteIdMaskFactory ;
20
13
use Magento \Quote \Model \QuoteManagement ;
21
14
use Magento \Quote \Model \QuoteRepository ;
22
- use Magento \Quote \Model \QuoteValidator ;
23
- use Magento \Sales \Api \Data \OrderInterfaceFactory as OrderFactory ;
24
- use Magento \Sales \Api \OrderManagementInterface as OrderManagement ;
25
- use Magento \Store \Model \StoreManagerInterface ;
26
15
27
16
/**
28
17
* Cart Management class for guest carts.
29
18
*
30
19
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
31
20
*/
32
- class GuestCartManagement extends QuoteManagement implements GuestCartManagementInterface
21
+ class GuestCartManagement implements GuestCartManagementInterface
33
22
{
23
+ /**
24
+ * @var CartManagementInterface
25
+ */
26
+ protected $ quoteManagement ;
27
+
28
+ /**
29
+ * @var QuoteRepository
30
+ */
31
+ protected $ quoteRepository ;
32
+
34
33
/**
35
34
* @var QuoteIdMaskFactory
36
35
*/
@@ -39,60 +38,19 @@ class GuestCartManagement extends QuoteManagement implements GuestCartManagement
39
38
/**
40
39
* Initialize dependencies.
41
40
*
42
- * @param EventManager $eventManager
43
- * @param QuoteValidator $quoteValidator
44
- * @param OrderFactory $orderFactory
45
- * @param OrderManagement $orderManagement
46
- * @param CustomerManagement $customerManagement
47
- * @param ToOrderConverter $quoteAddressToOrder
48
- * @param ToOrderAddressConverter $quoteAddressToOrderAddress
49
- * @param ToOrderItemConverter $quoteItemToOrderItem
50
- * @param ToOrderPaymentConverter $quotePaymentToOrderPayment
51
- * @param UserContextInterface $userContext
41
+ * @param CartManagementInterface $quoteManagement
52
42
* @param QuoteRepository $quoteRepository
53
- * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
54
- * @param \Magento\Customer\Model\CustomerFactory $customerModelFactory
55
- * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
56
- * @param StoreManagerInterface $storeManager
57
43
* @param QuoteIdMaskFactory $quoteIdMaskFactory
58
44
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
59
45
*/
60
46
public function __construct (
61
- EventManager $ eventManager ,
62
- QuoteValidator $ quoteValidator ,
63
- OrderFactory $ orderFactory ,
64
- OrderManagement $ orderManagement ,
65
- CustomerManagement $ customerManagement ,
66
- ToOrderConverter $ quoteAddressToOrder ,
67
- ToOrderAddressConverter $ quoteAddressToOrderAddress ,
68
- ToOrderItemConverter $ quoteItemToOrderItem ,
69
- ToOrderPaymentConverter $ quotePaymentToOrderPayment ,
70
- UserContextInterface $ userContext ,
47
+ CartManagementInterface $ quoteManagement ,
71
48
QuoteRepository $ quoteRepository ,
72
- \Magento \Customer \Api \CustomerRepositoryInterface $ customerRepository ,
73
- \Magento \Customer \Model \CustomerFactory $ customerModelFactory ,
74
- \Magento \Framework \Api \DataObjectHelper $ dataObjectHelper ,
75
- StoreManagerInterface $ storeManager ,
76
49
QuoteIdMaskFactory $ quoteIdMaskFactory
77
50
) {
51
+ $ this ->quoteManagement = $ quoteManagement ;
52
+ $ this ->quoteRepository = $ quoteRepository ;
78
53
$ this ->quoteIdMaskFactory = $ quoteIdMaskFactory ;
79
- parent ::__construct (
80
- $ eventManager ,
81
- $ quoteValidator ,
82
- $ orderFactory ,
83
- $ orderManagement ,
84
- $ customerManagement ,
85
- $ quoteAddressToOrder ,
86
- $ quoteAddressToOrderAddress ,
87
- $ quoteItemToOrderItem ,
88
- $ quotePaymentToOrderPayment ,
89
- $ userContext ,
90
- $ quoteRepository ,
91
- $ customerRepository ,
92
- $ customerModelFactory ,
93
- $ dataObjectHelper ,
94
- $ storeManager
95
- );
96
54
}
97
55
98
56
/**
@@ -102,7 +60,7 @@ public function createEmptyCart($customerId = null)
102
60
{
103
61
/** @var $quoteIdMask \Magento\Quote\Model\QuoteIdMask */
104
62
$ quoteIdMask = $ this ->quoteIdMaskFactory ->create ();
105
- $ cartId = parent :: createEmptyCart ($ customerId );
63
+ $ cartId = $ this -> quoteManagement -> createEmptyCart ($ customerId );
106
64
$ quoteIdMask ->setId ($ cartId )->save ();
107
65
return $ quoteIdMask ->getMaskedId ();
108
66
}
@@ -114,7 +72,7 @@ public function assignCustomer($cartId, $customerId, $storeId)
114
72
{
115
73
/** @var $quoteIdMask QuoteIdMask */
116
74
$ quoteIdMask = $ this ->quoteIdMaskFactory ->create ()->load ($ cartId , 'masked_id ' );
117
- return parent :: assignCustomer ($ quoteIdMask ->getId (), $ customerId , $ storeId );
75
+ return $ this -> quoteManagement -> assignCustomer ($ quoteIdMask ->getId (), $ customerId , $ storeId );
118
76
}
119
77
120
78
/**
@@ -124,7 +82,7 @@ public function placeOrder($cartId)
124
82
{
125
83
/** @var $quoteIdMask QuoteIdMask */
126
84
$ quoteIdMask = $ this ->quoteIdMaskFactory ->create ()->load ($ cartId , 'masked_id ' );
127
- return parent :: placeOrder ($ quoteIdMask ->getId ());
85
+ return $ this -> quoteManagement -> placeOrder ($ quoteIdMask ->getId ());
128
86
}
129
87
130
88
/**
0 commit comments