Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
default_rollback.php
Go to the documentation of this file.
1 <?php
8 
10 $registry = Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
11 $registry->unregister('isSecureArea');
12 $registry->register('isSecureArea', true);
13 
15 $orderCollection = Bootstrap::getObjectManager()->create(\Magento\Sales\Model\ResourceModel\Order\Collection::class);
16 foreach ($orderCollection as $order) {
17  $order->delete();
18 }
19 
21 $productCollection = Bootstrap::getObjectManager()->create(
22  \Magento\Catalog\Model\ResourceModel\Product\Collection::class
23 );
24 foreach ($productCollection as $product) {
25  $product->delete();
26 }
27 
29 $stockRegistryStorage = Bootstrap::getObjectManager()
30  ->get(\Magento\CatalogInventory\Model\StockRegistryStorage::class);
31 $stockRegistryStorage->clean();
32 
33 $registry->unregister('isSecureArea');
34 $registry->register('isSecureArea', false);
$stockRegistryStorage
$order
Definition: order.php:55
$productCollection
$orderCollection