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
Model
ResourceModel
IsProductAssignedToStock.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\Inventory\Model\ResourceModel
;
9
10
use
Magento\InventoryApi\Model\IsProductAssignedToStockInterface
;
11
use
Magento\Framework\App\ResourceConnection
;
12
use
Magento\InventoryApi\Api\Data\SourceItemInterface
;
13
use
Magento\InventoryApi\Api\Data\StockSourceLinkInterface
;
14
15
class
IsProductAssignedToStock
implements
IsProductAssignedToStockInterface
16
{
20
private
$resource;
21
25
public
function
__construct
(
26
ResourceConnection
$resource
27
) {
28
$this->resource =
$resource
;
29
}
30
34
public
function
execute
(
string
$sku,
int
$stockId): bool
35
{
36
$connection
= $this->resource->getConnection();
37
$select
=
$connection
->select()
38
->from(
39
[
'stock_source_link'
=> $this->resource->getTableName(
StockSourceLink::TABLE_NAME_STOCK_SOURCE_LINK
)]
40
)->join(
41
[
'inventory_source_item'
=> $this->resource->getTableName(
SourceItem::TABLE_NAME_SOURCE_ITEM
)],
42
'inventory_source_item.'
.
SourceItemInterface::SOURCE_CODE
.
'
43
= stock_source_link.'
.
SourceItemInterface::SOURCE_CODE
,
44
[]
45
)->where(
46
'stock_source_link.'
.
StockSourceLinkInterface::STOCK_ID
.
' = ?'
,
47
$stockId
48
)->where(
49
'inventory_source_item.'
.
SourceItemInterface::SKU
.
' = ?'
,
50
$sku
51
);
52
53
return
(
bool
)
$connection
->fetchOne(
$select
);
54
}
55
}
Magento\Inventory\Model\ResourceModel\StockSourceLink\TABLE_NAME_STOCK_SOURCE_LINK
const TABLE_NAME_STOCK_SOURCE_LINK
Definition:
StockSourceLink.php:20
Magento\Inventory\Model\ResourceModel\IsProductAssignedToStock
Definition:
IsProductAssignedToStock.php:15
$resource
$resource
Definition:
bulk.php:12
Magento\InventoryApi\Api\Data\SourceItemInterface\SOURCE_CODE
const SOURCE_CODE
Definition:
SourceItemInterface.php:26
Magento\InventoryApi\Api\Data\StockSourceLinkInterface
Definition:
StockSourceLinkInterface.php:17
Magento\InventoryApi\Api\Data\SourceItemInterface
Definition:
SourceItemInterface.php:20
$select
$select
Definition:
catalog_rule_10_off_not_logged_rollback.php:14
Magento\InventoryApi\Model\IsProductAssignedToStockInterface
Definition:
IsProductAssignedToStockInterface.php:10
Magento\InventoryApi\Api\Data\SourceItemInterface\SKU
const SKU
Definition:
SourceItemInterface.php:25
Magento\Inventory\Model\ResourceModel\SourceItem\TABLE_NAME_SOURCE_ITEM
const TABLE_NAME_SOURCE_ITEM
Definition:
SourceItem.php:20
Magento\InventoryApi\Api\Data\StockSourceLinkInterface\STOCK_ID
const STOCK_ID
Definition:
StockSourceLinkInterface.php:22
Magento\Inventory\Model\ResourceModel
Definition:
GetSourceCodesBySkus.php:8
Magento\Framework\App\ResourceConnection
Definition:
ResourceConnection.php:18
Magento\Inventory\Model\ResourceModel\IsProductAssignedToStock\execute
execute(string $sku, int $stockId)
Definition:
IsProductAssignedToStock.php:34
$connection
$connection
Definition:
bulk.php:13
Magento\Framework\App\ResourceConnection
Magento\Inventory\Model\ResourceModel\IsProductAssignedToStock\__construct
__construct(ResourceConnection $resource)
Definition:
IsProductAssignedToStock.php:25