Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateSalesChannelWebsiteCode.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
12 
19 {
23  private $resourceConnection;
24 
28  public function __construct(
29  ResourceConnection $resourceConnection
30  ) {
31  $this->resourceConnection = $resourceConnection;
32  }
33 
39  public function execute(
40  string $oldCode,
41  string $newCode
42  ): void {
43  $connection = $this->resourceConnection->getConnection();
44  $tableName = $this->resourceConnection->getTableName('inventory_stock_sales_channel');
45 
46  $connection->update(
47  $tableName,
48  [
49  SalesChannelInterface::CODE => $newCode,
50  ],
51  [
53  SalesChannelInterface::CODE . ' = ?' => $oldCode,
54  ]
55  );
56  }
57 }
$tableName
Definition: trigger.php:13
$connection
Definition: bulk.php:13