8
8
9
9
use Magento \Eav \Model \Config ;
10
10
use Magento \Framework \App \State ;
11
- use Magento \Quote \Model \QuoteFactory ;
12
- use Magento \Sales \Model \Order \Address ;
13
- use Magento \Sales \Model \OrderFactory ;
14
- use Magento \Sales \Model \ResourceModel \Order \Address \CollectionFactory as AddressCollectionFactory ;
15
- use Magento \Framework \App \ResourceConnection ;
16
- use Magento \Sales \Setup \SalesSetupFactory ;
11
+ use Magento \Framework \Setup \ModuleDataSetupInterface ;
17
12
use Magento \Framework \Setup \Patch \DataPatchInterface ;
18
13
use Magento \Framework \Setup \Patch \PatchVersionInterface ;
19
- use Magento \Framework \Setup \ModuleDataSetupInterface ;
14
+ use Magento \Sales \Model \Order \Address ;
15
+ use Magento \Sales \Setup \SalesSetupFactory ;
20
16
17
+ /**
18
+ * Fills quote_address_id in table sales_order_address if it is empty.
19
+ */
21
20
class FillQuoteAddressIdInSalesOrderAddress implements DataPatchInterface, PatchVersionInterface
22
21
{
23
22
/**
24
23
* @var ModuleDataSetupInterface
25
24
*/
26
25
private $ moduleDataSetup ;
27
26
28
- /**
29
- * @var SalesSetupFactory
30
- */
31
- private $ salesSetupFactory ;
32
-
33
27
/**
34
28
* @var State
35
29
*/
@@ -41,29 +35,22 @@ class FillQuoteAddressIdInSalesOrderAddress implements DataPatchInterface, Patch
41
35
private $ eavConfig ;
42
36
43
37
/**
44
- * PatchInitial constructor.
45
- *
46
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
47
- *
48
38
* @param ModuleDataSetupInterface $moduleDataSetup
39
+ * @param State $state
40
+ * @param Config $eavConfig
49
41
*/
50
42
public function __construct (
51
43
ModuleDataSetupInterface $ moduleDataSetup ,
52
- SalesSetupFactory $ salesSetupFactory ,
53
44
State $ state ,
54
- Config $ eavConfig ,
55
- AddressCollectionFactory $ addressCollectionFactory ,
56
- OrderFactory $ orderFactory ,
57
- QuoteFactory $ quoteFactory
45
+ Config $ eavConfig
58
46
) {
59
47
$ this ->moduleDataSetup = $ moduleDataSetup ;
60
- $ this ->salesSetupFactory = $ salesSetupFactory ;
61
48
$ this ->state = $ state ;
62
49
$ this ->eavConfig = $ eavConfig ;
63
50
}
64
51
65
52
/**
66
- * { @inheritdoc}
53
+ * @inheritdoc
67
54
*/
68
55
public function apply ()
69
56
{
@@ -87,7 +74,7 @@ public function fillQuoteAddressIdInSalesOrderAddress(ModuleDataSetupInterface $
87
74
}
88
75
89
76
/**
90
- * { @inheritdoc}
77
+ * @inheritdoc
91
78
*/
92
79
public static function getDependencies ()
93
80
{
@@ -97,24 +84,27 @@ public static function getDependencies()
97
84
}
98
85
99
86
/**
100
- * { @inheritdoc}
87
+ * @inheritdoc
101
88
*/
102
89
public static function getVersion ()
103
90
{
104
91
return '2.0.8 ' ;
105
92
}
106
93
107
94
/**
108
- * { @inheritdoc}
95
+ * @inheritdoc
109
96
*/
110
97
public function getAliases ()
111
98
{
112
99
return [];
113
100
}
114
101
115
102
/**
103
+ * Fill quote_address_id in sales_order_address by type.
104
+ *
116
105
* @param ModuleDataSetupInterface $setup
117
106
* @param string $addressType
107
+ * @throws \Zend_Db_Statement_Exception
118
108
*/
119
109
private function fillQuoteAddressIdInSalesOrderAddressByType (ModuleDataSetupInterface $ setup , $ addressType )
120
110
{
@@ -152,6 +142,8 @@ private function fillQuoteAddressIdInSalesOrderAddressByType(ModuleDataSetupInte
152
142
}
153
143
154
144
/**
145
+ * Process filling quote_address_id in sales_order_address in batch.
146
+ *
155
147
* @param ModuleDataSetupInterface $setup
156
148
* @param array $orderAddresses
157
149
* @param string $addressType
0 commit comments