Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Catalog
_files
attribute_set_with_image_attribute_rollback.php
Go to the documentation of this file.
1
<?php
8
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
9
10
$entityType
=
$objectManager
->create(\
Magento
\Eav\Model\Entity\Type::class)->loadByCode(
'catalog_product'
);
11
12
// remove attribute
13
15
$attributeCollection
=
$objectManager
->create(\
Magento
\Catalog\Model\
ResourceModel
\Product\Attribute\Collection::class);
16
$attributeCollection
->setFrontendInputTypeFilter(
'media_image'
);
17
$attributeCollection
->setCodeFilter(
'funny_image'
);
18
$attributeCollection
->setEntityTypeFilter(
$entityType
->getId());
19
$attributeCollection
->setPageSize(1);
20
$attributeCollection
->load();
21
$attribute
=
$attributeCollection
->fetchItem();
22
$attribute
->delete();
23
24
// remove attribute set
25
27
$attributeSetCollection
=
$objectManager
->create(
28
\
Magento
\Eav\Model\
ResourceModel
\Entity\Attribute\Set\Collection::class
29
);
30
$attributeSetCollection
->addFilter(
'attribute_set_name'
,
'attribute_set_with_media_attribute'
);
31
$attributeSetCollection
->addFilter(
'entity_type_id'
,
$entityType
->getId());
32
$attributeSetCollection
->setOrder(
'attribute_set_id'
);
// descending is default value
33
$attributeSetCollection
->setPageSize(1);
34
$attributeSetCollection
->load();
35
37
$attributeSet
=
$attributeSetCollection
->fetchItem();
38
$attributeSet
->delete();
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
$attributeSet
$attributeSet
Definition:
attribute_set_with_image_attribute_rollback.php:37
$attribute
$attribute
Definition:
attribute_set_with_image_attribute_rollback.php:21
$objectManager
$objectManager
Definition:
attribute_set_with_image_attribute_rollback.php:8
Magento
$attributeCollection
$attributeCollection
Definition:
attribute_set_with_image_attribute_rollback.php:15
$attributeSetCollection
$attributeSetCollection
Definition:
attribute_set_with_image_attribute_rollback.php:27
$entityType
$entityType
Definition:
attribute_set_with_image_attribute_rollback.php:10
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125