Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-inventory-sales
Model
ResourceModel
StockIdResolver.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventorySales\Model\ResourceModel
;
9
10
use
Magento\Framework\App\ResourceConnection
;
11
use
Magento\InventorySalesApi\Api\Data\SalesChannelInterface
;
12
17
class
StockIdResolver
18
{
22
private
$resourceConnection;
23
27
public
function
__construct
(
28
ResourceConnection
$resourceConnection
29
) {
30
$this->resourceConnection =
$resourceConnection
;
31
}
32
40
public
function
resolve
(
string
$type
,
string
$code
)
41
{
42
$connection
= $this->resourceConnection->getConnection();
43
$tableName
= $this->resourceConnection->getTableName(
'inventory_stock_sales_channel'
);
44
45
$select
=
$connection
->select()
46
->from(
$tableName
,
'stock_id'
)
47
->where(
SalesChannelInterface::TYPE
.
' = ?'
,
$type
)
48
->where(
SalesChannelInterface::CODE
.
' = ?'
,
$code
);
49
50
$stockId =
$connection
->fetchOne(
$select
);
51
return
false
=== $stockId ? null : (int)$stockId;
52
}
53
}
Magento\InventorySales\Model\ResourceModel\StockIdResolver
Definition:
StockIdResolver.php:17
$tableName
$tableName
Definition:
trigger.php:13
Magento\InventorySalesApi\Api\Data\SalesChannelInterface\CODE
const CODE
Definition:
SalesChannelInterface.php:23
Magento\InventorySales\Model\ResourceModel
Definition:
DeleteSalesChannelToStockLink.php:8
$type
$type
Definition:
item.phtml:13
$select
$select
Definition:
catalog_rule_10_off_not_logged_rollback.php:14
Magento\InventorySales\Model\ResourceModel\StockIdResolver\__construct
__construct(ResourceConnection $resourceConnection)
Definition:
StockIdResolver.php:27
Magento\InventorySalesApi\Api\Data\SalesChannelInterface
Definition:
SalesChannelInterface.php:17
Magento\InventorySalesApi\Api\Data\SalesChannelInterface\TYPE
const TYPE
Definition:
SalesChannelInterface.php:22
Magento\InventorySales\Model\ResourceModel\StockIdResolver\resolve
resolve(string $type, string $code)
Definition:
StockIdResolver.php:40
$resourceConnection
$resourceConnection
Definition:
website_attribute_sync.php:32
Magento\Framework\App\ResourceConnection
Definition:
ResourceConnection.php:18
$connection
$connection
Definition:
bulk.php:13
Magento\Framework\App\ResourceConnection
$code
$code
Definition:
info.phtml:12