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
module-catalog
Setup
Patch
Data
UpdateDefaultAttributeValue.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Catalog\Setup\Patch\Data
;
8
9
use
Magento\Catalog\Setup\CategorySetup
;
10
use Magento\Catalog\Setup\CategorySetupFactory;
11
use
Magento\Framework\App\ResourceConnection
;
12
use
Magento\Framework\Setup\ModuleDataSetupInterface
;
13
use
Magento\Framework\Setup\Patch\DataPatchInterface
;
14
use
Magento\Framework\Setup\Patch\PatchVersionInterface
;
15
20
class
UpdateDefaultAttributeValue
implements
DataPatchInterface
,
PatchVersionInterface
21
{
25
private
$moduleDataSetup;
26
30
private
$categorySetupFactory;
31
37
public
function
__construct
(
38
ModuleDataSetupInterface
$moduleDataSetup,
39
CategorySetupFactory $categorySetupFactory
40
) {
41
$this->moduleDataSetup = $moduleDataSetup;
42
$this->categorySetupFactory = $categorySetupFactory;
43
}
44
48
public
function
apply
()
49
{
51
$categorySetup = $this->categorySetupFactory->create([
'setup'
=> $this->moduleDataSetup]);
52
$categorySetup->updateAttribute(3, 54,
'default_value'
, 1);
53
}
54
58
public
static
function
getDependencies
()
59
{
60
return
[
61
SetNewResourceModelsPaths::class,
62
];
63
}
64
68
public
static
function
getVersion
()
69
{
70
return
'2.0.3'
;
71
}
72
76
public
function
getAliases
()
77
{
78
return
[];
79
}
80
}
Magento\Catalog\Setup\Patch\Data\UpdateDefaultAttributeValue\getAliases
getAliases()
Definition:
UpdateDefaultAttributeValue.php:76
Magento\Framework\Setup\Patch\DataPatchInterface
Definition:
DataPatchInterface.php:12
Magento\Catalog\Setup\Patch\Data\UpdateDefaultAttributeValue
Definition:
UpdateDefaultAttributeValue.php:20
Magento\Catalog\Setup\CategorySetup
Definition:
CategorySetup.php:59
Magento\Framework\Setup\ModuleDataSetupInterface
Definition:
ModuleDataSetupInterface.php:14
Magento\Framework\Setup\Patch\PatchInterface\apply
apply()
Magento\Catalog\Setup\Patch\Data\UpdateDefaultAttributeValue\getDependencies
static getDependencies()
Definition:
UpdateDefaultAttributeValue.php:58
Magento\Framework\Setup\Patch\PatchVersionInterface
Definition:
PatchVersionInterface.php:13
Magento\Catalog\Setup\Patch\Data\UpdateDefaultAttributeValue\getVersion
static getVersion()
Definition:
UpdateDefaultAttributeValue.php:68
Magento\Catalog\Setup\Patch\Data\UpdateDefaultAttributeValue\__construct
__construct(ModuleDataSetupInterface $moduleDataSetup, CategorySetupFactory $categorySetupFactory)
Definition:
UpdateDefaultAttributeValue.php:37
Magento\Catalog\Setup\Patch\Data
Definition:
ChangePriceAttributeDefaultScope.php:7
Magento\Framework\App\ResourceConnection