88
99use Magento \Eav \Model \Config ;
1010use 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 ;
1712use Magento \Framework \Setup \Patch \DataPatchInterface ;
1813use Magento \Framework \Setup \Patch \PatchVersionInterface ;
19- use Magento \Framework \Setup \ModuleDataSetupInterface ;
14+ use Magento \Sales \Model \Order \Address ;
15+ use Magento \Sales \Setup \SalesSetupFactory ;
2016
17+ /**
18+ * Fills quote_address_id in table sales_order_address if it is empty.
19+ */
2120class FillQuoteAddressIdInSalesOrderAddress implements DataPatchInterface, PatchVersionInterface
2221{
2322 /**
2423 * @var ModuleDataSetupInterface
2524 */
2625 private $ moduleDataSetup ;
2726
28- /**
29- * @var SalesSetupFactory
30- */
31- private $ salesSetupFactory ;
32-
3327 /**
3428 * @var State
3529 */
@@ -41,29 +35,22 @@ class FillQuoteAddressIdInSalesOrderAddress implements DataPatchInterface, Patch
4135 private $ eavConfig ;
4236
4337 /**
44- * PatchInitial constructor.
45- *
46- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
47- *
4838 * @param ModuleDataSetupInterface $moduleDataSetup
39+ * @param State $state
40+ * @param Config $eavConfig
4941 */
5042 public function __construct (
5143 ModuleDataSetupInterface $ moduleDataSetup ,
52- SalesSetupFactory $ salesSetupFactory ,
5344 State $ state ,
54- Config $ eavConfig ,
55- AddressCollectionFactory $ addressCollectionFactory ,
56- OrderFactory $ orderFactory ,
57- QuoteFactory $ quoteFactory
45+ Config $ eavConfig
5846 ) {
5947 $ this ->moduleDataSetup = $ moduleDataSetup ;
60- $ this ->salesSetupFactory = $ salesSetupFactory ;
6148 $ this ->state = $ state ;
6249 $ this ->eavConfig = $ eavConfig ;
6350 }
6451
6552 /**
66- * { @inheritdoc}
53+ * @inheritdoc
6754 */
6855 public function apply ()
6956 {
@@ -87,7 +74,7 @@ public function fillQuoteAddressIdInSalesOrderAddress(ModuleDataSetupInterface $
8774 }
8875
8976 /**
90- * { @inheritdoc}
77+ * @inheritdoc
9178 */
9279 public static function getDependencies ()
9380 {
@@ -97,24 +84,27 @@ public static function getDependencies()
9784 }
9885
9986 /**
100- * { @inheritdoc}
87+ * @inheritdoc
10188 */
10289 public static function getVersion ()
10390 {
10491 return '2.0.8 ' ;
10592 }
10693
10794 /**
108- * { @inheritdoc}
95+ * @inheritdoc
10996 */
11097 public function getAliases ()
11198 {
11299 return [];
113100 }
114101
115102 /**
103+ * Fill quote_address_id in sales_order_address by type.
104+ *
116105 * @param ModuleDataSetupInterface $setup
117106 * @param string $addressType
107+ * @throws \Zend_Db_Statement_Exception
118108 */
119109 private function fillQuoteAddressIdInSalesOrderAddressByType (ModuleDataSetupInterface $ setup , $ addressType )
120110 {
@@ -152,6 +142,8 @@ private function fillQuoteAddressIdInSalesOrderAddressByType(ModuleDataSetupInte
152142 }
153143
154144 /**
145+ * Process filling quote_address_id in sales_order_address in batch.
146+ *
155147 * @param ModuleDataSetupInterface $setup
156148 * @param array $orderAddresses
157149 * @param string $addressType
0 commit comments