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
Test
_files
reindex_inventory_rollback.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Framework\Module\Manager
;
9
use
Magento\InventoryApi\Api\StockRepositoryInterface
;
10
use
Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface
;
11
use
Magento\InventoryIndexer\Test\Integration\Indexer\RemoveIndexData
;
12
use
Magento\TestFramework\Helper\Bootstrap
;
13
15
$stockRepository
= Bootstrap::getObjectManager()->get(StockRepositoryInterface::class);
17
$removeIndexData
= Bootstrap::getObjectManager()->get(RemoveIndexData::class);
18
19
$stockIds
= [];
20
foreach
(
$stockRepository
->getList()->getItems() as
$stock
) {
21
$stockIds
[
$stock
->getStockId()] =
$stock
->getStockId();
22
}
23
25
$moduleManager
= Bootstrap::getObjectManager()->get(Manager::class);
26
// soft dependency in tests because we don't have possibility replace fixture from different modules
27
if
(
$moduleManager
->isEnabled(
'Magento_InventoryCatalog'
)) {
29
$defaultStockProvider = Bootstrap::getObjectManager()->get(DefaultStockProviderInterface::class);
30
unset(
$stockIds
[$defaultStockProvider->getId()]);
31
}
32
33
$removeIndexData
->execute(array_values(
$stockIds
));
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$moduleManager
$moduleManager
Definition:
reindex_inventory_rollback.php:25
Magento\InventoryApi\Api\StockRepositoryInterface
Definition:
StockRepositoryInterface.php:26
$removeIndexData
$removeIndexData
Definition:
reindex_inventory_rollback.php:17
$stockRepository
$stockRepository
Definition:
reindex_inventory_rollback.php:15
Magento\Framework\Module\Manager
Definition:
Manager.php:20
Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface
Definition:
DefaultStockProviderInterface.php:15
$stock
$stock
Definition:
product_alert.php:22
$stockIds
$stockIds
Definition:
reindex_inventory_rollback.php:19
Magento\InventoryIndexer\Test\Integration\Indexer\RemoveIndexData
Definition:
RemoveIndexData.php:16