Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
configurable_attribute_rollback.php
Go to the documentation of this file.
1 <?php
9 
10 $registry->unregister('isSecureArea');
11 $registry->register('isSecureArea', true);
13  ->get(\Magento\Catalog\Model\ResourceModel\Product\Collection::class);
14 foreach ($productCollection as $product) {
15  $product->delete();
16 }
17 
19 $attribute = $eavConfig->getAttribute('catalog_product', 'test_configurable');
20 if ($attribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute
21  && $attribute->getId()
22 ) {
23  $attribute->delete();
24 }
25 $eavConfig->clear();
26 
27 $registry->unregister('isSecureArea');
28 $registry->register('isSecureArea', false);
foreach($productCollection as $product) $eavConfig