Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateDefaultAttributeValue.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Setup\CategorySetupFactory;
15 
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 }
__construct(ModuleDataSetupInterface $moduleDataSetup, CategorySetupFactory $categorySetupFactory)