Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
custom_category_store_media_disabled_rollback.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
10 $registry = $objectManager->get(\Magento\Framework\Registry::class);
11 $registry->unregister('isSecureArea');
12 $registry->register('isSecureArea', true);
13 
15 $category = $objectManager->create(\Magento\Catalog\Model\Category::class);
16 $category->loadByAttribute('name', 'MV');
17 if ($category->getId()) {
18  $category->delete();
19 }
20 
22 $store = $objectManager->create(\Magento\Store\Model\Store::class);
23 $store->load('mascota', 'code');
24 if ($store->getId()) {
25  $store->delete();
26 }
27 
29 $website = $objectManager->create(\Magento\Store\Model\Website::class);
30 $website->load('mascota', 'code');
31 if ($website->getId()) {
32  $website->delete();
33 }
34 
36 $attributeSet = $objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class);
37 $attributeSet->load('vinos', 'attribute_set_name');
38 if ($attributeSet->getId()) {
39  $attributeSet->delete();
40 }
41 
42 $registry->unregister('isSecureArea');
43 $registry->register('isSecureArea', false);