resourceConnection = $resourceConnection; } /** * Returns the linked stock id by given a sales channel type and code * * @param string $type * @param string $code * @return int|null */ public function resolve(string $type, string $code) { $connection = $this->resourceConnection->getConnection(); $tableName = $this->resourceConnection->getTableName('inventory_stock_sales_channel'); $select = $connection->select() ->from($tableName, 'stock_id') ->where(SalesChannelInterface::TYPE . ' = ?', $type) ->where(SalesChannelInterface::CODE . ' = ?', $code); $stockId = $connection->fetchOne($select); return false === $stockId ? null : (int)$stockId; } }