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-api
Test
_files
stock_source_links_rollback.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\InventoryApi\Api\Data\StockSourceLinkInterface
;
9
use Magento\InventoryApi\Api\Data\StockSourceLinkInterfaceFactory;
10
use
Magento\InventoryApi\Api\StockSourceLinksDeleteInterface
;
11
use
Magento\TestFramework\Helper\Bootstrap
;
12
14
$stockSourceLinkFactory
= Bootstrap::getObjectManager()->get(StockSourceLinkInterfaceFactory::class);
16
$stockSourceLinksDelete
= Bootstrap::getObjectManager()->get(StockSourceLinksDeleteInterface::class);
17
36
$linksData
= [
37
10 => [
'eu-1'
,
'eu-2'
,
'eu-3'
,
'eu-disabled'
],
38
20 => [
'us-1'
],
39
30 => [
'eu-1'
,
'eu-2'
,
'eu-3'
,
'eu-disabled'
,
'us-1'
]
40
];
41
42
$links
= [];
43
44
foreach
(
$linksData
as $stockID => $sourceCodes) {
45
foreach
($sourceCodes as
$sourceCode
) {
47
$link
=
$stockSourceLinkFactory
->create();
48
49
$link
->setStockId($stockID);
50
$link
->setSourceCode(
$sourceCode
);
51
52
$links
[] =
$link
;
53
}
54
}
55
56
$stockSourceLinksDelete
->execute(
$links
);
$linksData
$linksData
Definition:
stock_source_links_rollback.php:36
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
Magento\InventoryApi\Api\Data\StockSourceLinkInterface
Definition:
StockSourceLinkInterface.php:17
$link
$link
Definition:
quote_with_downloadable_product.php:27
$links
$links
Definition:
stock_source_links_rollback.php:42
$sourceCode
$sourceCode
Definition:
inventory.phtml:11
Magento\InventoryApi\Api\StockSourceLinksDeleteInterface
Definition:
StockSourceLinksDeleteInterface.php:18
$stockSourceLinkFactory
$stockSourceLinkFactory
Definition:
stock_source_links_rollback.php:14
$stockSourceLinksDelete
$stockSourceLinksDelete
Definition:
stock_source_links_rollback.php:16