Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
products_list_rollback.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
10 
11 $registry->unregister('isSecureArea');
12 $registry->register('isSecureArea', true);
13 
18  ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
19 try {
20  $product = $productRepository->get('wrong-simple', false, null, true);
22 } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
23  //Product already removed
24 }
25 
26 try {
27  $customDesignProduct = $productRepository->get('simple-156', false, null, true);
29 } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
30  //Product already removed
31 }
32 
33 try {
34  $customDesignProduct = $productRepository->get('simple-249', false, null, true);
36 } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
37  //Product already removed
38 }
39 
40 
41 $registry->unregister('isSecureArea');
42 $registry->register('isSecureArea', false);
$customDesignProduct
Definition: products.php:27