6 declare(strict_types=1);
28 private $resourceConnection;
33 private $getIsStockItemSalableCondition;
38 private $productTableName;
48 string $productTableName
51 $this->getIsStockItemSalableCondition = $getIsStockItemSalableCondition;
52 $this->productTableName = $productTableName;
61 $connection = $this->resourceConnection->getConnection();
62 $sourceItemTable = $this->resourceConnection->getTableName(SourceItemResourceModel::TABLE_NAME_SOURCE_ITEM);
64 $quantityExpression = (string)$this->resourceConnection->getConnection()->getCheckSql(
69 $sourceCodes = $this->getSourceCodes($stockId);
73 [
'product' => $this->resourceConnection->getTableName($this->productTableName)],
77 [
'legacy_stock_item' => $this->resourceConnection->getTableName(
'cataloginventory_stock_item')],
78 'product.entity_id = legacy_stock_item.product_id',
83 [
'source_item' => $sourceItemTable],
102 private function getSourceCodes(
int $stockId): array
104 $connection = $this->resourceConnection->getConnection();
105 $sourceTable = $this->resourceConnection->getTableName(SourceResourceModel::TABLE_NAME_SOURCE);
106 $sourceStockLinkTable = $this->resourceConnection->getTableName(
107 StockSourceLinkResourceModel::TABLE_NAME_STOCK_SOURCE_LINK
113 [
'stock_source_link' => $sourceStockLinkTable],
const STATUS_OUT_OF_STOCK
__construct(ResourceConnection $resourceConnection, GetIsStockItemSalableConditionInterface $getIsStockItemSalableCondition, string $productTableName)