resourceConnection = $resourceConnection; } /** * @inheritdoc */ public function execute(string $websiteCode): ?int { $connection = $this->resourceConnection->getConnection(); $tableName = $this->resourceConnection->getTableName('inventory_stock_sales_channel'); $select = $connection->select() ->from($tableName, ['stock_id']) ->where('code = ?', $websiteCode) ->where('type = ?', SalesChannelInterface::TYPE_WEBSITE); $result = $connection->fetchCol($select); if (count($result) === 0) { return null; } return (int)reset($result); } }