Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GetAssignedSalesChannelsDataForStock.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
11 
16 {
20  private $resourceConnection;
21 
25  public function __construct(
26  ResourceConnection $resourceConnection
27  ) {
28  $this->resourceConnection = $resourceConnection;
29  }
30 
37  public function execute(int $stockId): array
38  {
39  $connection = $this->resourceConnection->getConnection();
40  $tableName = $this->resourceConnection->getTableName('inventory_stock_sales_channel');
41 
42  $select = $connection->select()
43  ->from($tableName)
44  ->where('stock_id = ?', $stockId);
45 
46  return $connection->fetchAll($select);
47  }
48 }
$tableName
Definition: trigger.php:13
$connection
Definition: bulk.php:13