Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
product_simple_duplicated_rollback.php
Go to the documentation of this file.
1 <?php
8 
11 
12 $registry->unregister('isSecureArea');
13 $registry->register('isSecureArea', true);
14 
16 $productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
17 
18 try {
19  $product = $productRepository->get('simple-1', false, null, true);
21 } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
22  //Product already removed
23 }
24 
25 $registry->unregister('isSecureArea');
26 $registry->register('isSecureArea', false);