Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateProductMetaDescription.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Eav\Setup\EavSetupFactory;
15 
22 {
26  private $moduleDataSetup;
27 
31  private $eavSetupFactory;
32 
38  public function __construct(
39  ModuleDataSetupInterface $moduleDataSetup,
40  EavSetupFactory $eavSetupFactory
41  ) {
42  $this->moduleDataSetup = $moduleDataSetup;
43  $this->eavSetupFactory = $eavSetupFactory;
44  }
45 
49  public function apply()
50  {
52  $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
53 
54  $eavSetup->updateAttribute(
55  \Magento\Catalog\Model\Product::ENTITY,
56  'meta_description',
57  [
58  'note' => 'Maximum 255 chars. Meta Description should optimally be between 150-160 characters'
59  ]
60  );
61  }
62 
66  public static function getDependencies()
67  {
68  return [
69  UpdateProductAttributes::class,
70  ];
71  }
72 
76  public static function getVersion()
77  {
78  return '2.0.7';
79  }
80 
84  public function getAliases()
85  {
86  return [];
87  }
88 }
__construct(ModuleDataSetupInterface $moduleDataSetup, EavSetupFactory $eavSetupFactory)