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
magento2-base
dev
tests
integration
testsuite
Magento
CatalogSearch
_files
product_configurable_with_single_child_rollback.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Catalog\Api\Data\ProductInterface
;
9
use
Magento\Framework\Api\SearchCriteriaBuilder
;
10
use
Magento\TestFramework\Helper\Bootstrap
;
11
12
$objectManager
= Bootstrap::getObjectManager();
13
15
$registry
=
$objectManager
->get(\
Magento
\Framework\Registry::class);
16
17
$registry
->unregister(
'isSecureArea'
);
18
$registry
->register(
'isSecureArea'
,
true
);
19
21
$productRepository
= Bootstrap::getObjectManager()
22
->get(\
Magento
\Catalog\Api\ProductRepositoryInterface::class);
23
24
$productSkus
= [
'configurable_option_single_child'
,
'configurable_with_single_child'
];
26
$searchCriteriaBuilder
= Bootstrap::getObjectManager()->get(SearchCriteriaBuilder::class);
27
$searchCriteriaBuilder
->addFilter(ProductInterface::SKU,
$productSkus
,
'in'
);
28
$result
=
$productRepository
->getList(
$searchCriteriaBuilder
->create());
29
foreach
(
$result
->getItems() as
$product
) {
30
$productRepository
->delete(
$product
);
31
}
32
33
require
__DIR__
.
'/../../../Magento/Framework/Search/_files/configurable_attribute_rollback.php'
;
34
35
$registry
->unregister(
'isSecureArea'
);
36
$registry
->register(
'isSecureArea'
,
false
);
Magento\Framework\Api\SearchCriteriaBuilder
Definition:
SearchCriteriaBuilder.php:14
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$searchCriteriaBuilder
$searchCriteriaBuilder
Definition:
product_configurable_with_single_child_rollback.php:26
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$productRepository
$productRepository
Definition:
product_configurable_with_single_child_rollback.php:21
$registry
$registry
Definition:
product_configurable_with_single_child_rollback.php:15
$objectManager
$objectManager
Definition:
product_configurable_with_single_child_rollback.php:12
$result
$result
Definition:
product_configurable_with_single_child_rollback.php:28
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$productSkus
$productSkus
Definition:
product_configurable_with_single_child_rollback.php:24
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14