Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
products_multi_option_rollback.php
Go to the documentation of this file.
1 <?php
8 $registry = $objectManager->get(\Magento\Framework\Registry::class);
9 
10 $registry->unregister('isSecureArea');
11 $registry->register('isSecureArea', true);
12 
14 $collection = $objectManager->create(\Magento\Catalog\Model\ResourceModel\Product\Collection::class);
15 $collection->addAttributeToSelect('id')->load();
16 if ($collection->count() > 0) {
17  $collection->delete();
18 }
19 
20 $registry->unregister('isSecureArea');
21 $registry->register('isSecureArea', false);