Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateTaxClassAttributeVisibility.php
Go to the documentation of this file.
1 <?php
8 
13 use Magento\Tax\Setup\TaxSetupFactory;
14 
20 {
24  private $moduleDataSetup;
25 
29  private $taxSetupFactory;
30 
36  public function __construct(
37  \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup,
38  TaxSetupFactory $taxSetupFactory
39  ) {
40  $this->moduleDataSetup = $moduleDataSetup;
41  $this->taxSetupFactory = $taxSetupFactory;
42  }
43 
47  public function apply()
48  {
50  $taxSetup = $this->taxSetupFactory->create(['resourceName' => 'tax_setup', 'setup' => $this->moduleDataSetup]);
51 
52  $this->moduleDataSetup->getConnection()->startSetup();
53 
54  //Update the tax_class_id attribute in the 'catalog_eav_attribute' table
55  $taxSetup->updateAttribute(
56  \Magento\Catalog\Model\Product::ENTITY,
57  'tax_class_id',
58  'is_visible_in_advanced_search',
59  false
60  );
61  $this->moduleDataSetup->getConnection()->endSetup();
62  }
63 
67  public static function getDependencies()
68  {
69  return [
70  AddTaxAttributeAndTaxClasses::class
71  ];
72  }
73 
77  public static function getVersion()
78  {
79  return '2.0.1';
80  }
81 
85  public function getAliases()
86  {
87  return [];
88  }
89 }
__construct(\Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup, TaxSetupFactory $taxSetupFactory)