Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
categories_rollback.php
Go to the documentation of this file.
1 <?php
9 $registry = $objectManager->get(\Magento\Framework\Registry::class);
10 
11 $registry->unregister('isSecureArea');
12 $registry->register('isSecureArea', true);
13 
15 $collection = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Category\Collection::class);
17  ->addAttributeToFilter('level', 2)
18  ->load()
19  ->delete();
20 
21 $registry->unregister('isSecureArea');
22 $registry->register('isSecureArea', false);
$objectManager