Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateQuoteShippingAddresses.php
Go to the documentation of this file.
1 <?php
8 
15 
17 {
21  private $moduleDataSetup;
22 
27  public function __construct(
28  \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
29  ) {
30  $this->moduleDataSetup = $moduleDataSetup;
31  }
32 
36  public function apply()
37  {
38  // setup default
39  $this->moduleDataSetup->getConnection()->startSetup();
40  $connection = $this->moduleDataSetup->getConnection();
41  $salesConnection = $this->moduleDataSetup->getConnection('sales');
42  $checkoutConnection = $this->moduleDataSetup->getConnection('checkout');
43  $connection->update(
44  $this->moduleDataSetup->getTable('salesrule'),
45  ['simple_free_shipping' => 0],
46  [new \Zend_Db_Expr('simple_free_shipping IS NULL')]
47  );
48  $this->moduleDataSetup->getConnection()->endSetup();
49 
50  // setup sales
51  $salesConnection->startSetup();
52  $salesConnection->update(
53  $this->moduleDataSetup->getTable('sales_order_item'),
54  ['free_shipping' => 0],
55  [new \Zend_Db_Expr('free_shipping IS NULL')]
56  );
57  $salesConnection->endSetup();
58 
59  // setup checkout
60  $checkoutConnection->startSetup();
61  $checkoutConnection->update(
62  $this->moduleDataSetup->getTable('quote_address'),
63  ['free_shipping' => 0],
64  [new \Zend_Db_Expr('free_shipping IS NULL')]
65  );
66  $checkoutConnection->update(
67  $this->moduleDataSetup->getTable('quote_item'),
68  ['free_shipping' => 0],
69  [new \Zend_Db_Expr('free_shipping IS NULL')]
70  );
71  $checkoutConnection->endSetup();
72  }
73 
77  public static function getDependencies()
78  {
79  return [];
80  }
81 
85  public static function getVersion()
86  {
87  return '2.0.1';
88  }
89 
93  public function getAliases()
94  {
95  return [];
96  }
97 }
__construct(\Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup)
$connection
Definition: bulk.php:13