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-indexer
Indexer
Source
GetAssignedStockIds.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryIndexer\Indexer\Source
;
9
10
use
Magento\Framework\App\ResourceConnection
;
11
use
Magento\Inventory\Model\ResourceModel\StockSourceLink
as
StockSourceLinkResourceModel
;
12
use
Magento\Inventory\Model\StockSourceLink
;
13
17
class
GetAssignedStockIds
18
{
22
private
$resourceConnection;
23
27
public
function
__construct
(
28
ResourceConnection
$resourceConnection
29
) {
30
$this->resourceConnection =
$resourceConnection
;
31
}
32
37
public
function
execute
(array $sourceCodes): array
38
{
39
$connection
= $this->resourceConnection->getConnection();
40
$sourceStockLinkTable = $this->resourceConnection->getTableName(
41
StockSourceLinkResourceModel::TABLE_NAME_STOCK_SOURCE_LINK
42
);
43
44
$select
=
$connection
45
->select()
46
->from($sourceStockLinkTable,
StockSourceLink::STOCK_ID
)
47
->where(
StockSourceLink::SOURCE_CODE
.
' IN (?)'
, $sourceCodes)
48
->group(
StockSourceLink::STOCK_ID
);
49
50
$stockIds
=
$connection
->fetchCol(
$select
);
51
$stockIds
= array_map(
'intval'
,
$stockIds
);
52
return
$stockIds
;
53
}
54
}
Magento\Inventory\Model\StockSourceLink
Magento\InventoryIndexer\Indexer\Source\GetAssignedStockIds
Definition:
GetAssignedStockIds.php:17
Magento\InventoryIndexer\Indexer\Source\GetAssignedStockIds\__construct
__construct(ResourceConnection $resourceConnection)
Definition:
GetAssignedStockIds.php:27
$select
$select
Definition:
catalog_rule_10_off_not_logged_rollback.php:14
Magento\Inventory\Model\ResourceModel\StockSourceLink
Definition:
Collection.php:8
Magento\InventoryApi\Api\Data\StockSourceLinkInterface\STOCK_ID
const STOCK_ID
Definition:
StockSourceLinkInterface.php:22
$resourceConnection
$resourceConnection
Definition:
website_attribute_sync.php:32
Magento\Framework\App\ResourceConnection
Definition:
ResourceConnection.php:18
$stockIds
$stockIds
Definition:
reindex_inventory_rollback.php:19
Magento\InventoryApi\Api\Data\StockSourceLinkInterface\SOURCE_CODE
const SOURCE_CODE
Definition:
StockSourceLinkInterface.php:23
$connection
$connection
Definition:
bulk.php:13
Magento\Framework\App\ResourceConnection
Magento\InventoryIndexer\Indexer\Source\GetAssignedStockIds\execute
execute(array $sourceCodes)
Definition:
GetAssignedStockIds.php:37
Magento\InventoryIndexer\Indexer\Source
Definition:
GetAssignedStockIds.php:8