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-bundle-product
Test
_files
product_bundle_rollback.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Catalog\Api\ProductRepositoryInterface
;
9
use
Magento\Framework\Exception\NoSuchEntityException
;
10
use
Magento\Framework\Registry
;
11
use
Magento\TestFramework\Helper\Bootstrap
;
12
13
$objectManager
= Bootstrap::getObjectManager();
14
16
$registry
=
$objectManager
->get(Registry::class);
17
18
$registry
->unregister(
'isSecureArea'
);
19
$registry
->register(
'isSecureArea'
,
true
);
20
22
$productRepository
= Bootstrap::getObjectManager()
23
->get(ProductRepositoryInterface::class);
24
25
foreach
([
'simple_10'
,
'bundle'
] as $sku) {
26
try
{
27
$product
=
$productRepository
->get($sku,
false
,
null
,
true
);
28
$productRepository
->delete(
$product
);
29
}
catch
(
NoSuchEntityException
$e) {
30
//Product already removed
31
}
32
}
33
$registry
->unregister(
'isSecureArea'
);
34
$registry
->register(
'isSecureArea'
,
false
);
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$registry
$registry
Definition:
product_bundle_rollback.php:16
$productRepository
$productRepository
Definition:
product_bundle_rollback.php:22
Magento\Catalog\Api\ProductRepositoryInterface
Definition:
ProductRepositoryInterface.php:14
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Framework\Registry
Definition:
Registry.php:18
$objectManager
$objectManager
Definition:
product_bundle_rollback.php:13
Magento\Framework\Exception\NoSuchEntityException
Definition:
NoSuchEntityException.php:16