Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateIdentifierCustomerAttributesVisibility.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Customer\Setup\CustomerSetupFactory;
14 
20 {
24  private $moduleDataSetup;
25 
29  private $customerSetupFactory;
30 
36  public function __construct(
37  ModuleDataSetupInterface $moduleDataSetup,
38  CustomerSetupFactory $customerSetupFactory
39  ) {
40  $this->moduleDataSetup = $moduleDataSetup;
41  $this->customerSetupFactory = $customerSetupFactory;
42  }
43 
47  public function apply()
48  {
49  $customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
50  $entityAttributes = [
51  'customer_address' => [
52  'region_id' => [
53  'is_used_in_grid' => false,
54  'is_visible_in_grid' => false,
55  'is_filterable_in_grid' => false,
56  'is_searchable_in_grid' => false,
57  ],
58  'firstname' => [
59  'is_used_in_grid' => true,
60  'is_visible_in_grid' => false,
61  'is_filterable_in_grid' => false,
62  'is_searchable_in_grid' => true,
63  ],
64  'lastname' => [
65  'is_used_in_grid' => true,
66  'is_visible_in_grid' => false,
67  'is_filterable_in_grid' => false,
68  'is_searchable_in_grid' => true,
69  ],
70  ],
71  ];
72  $customerSetup->upgradeAttributes($entityAttributes);
73  }
74 
78  public static function getDependencies()
79  {
80  return [
81  AddNonSpecifiedGenderAttributeOption::class,
82  ];
83  }
84 
88  public static function getVersion()
89  {
90  return '2.0.3';
91  }
92 
96  public function getAliases()
97  {
98  return [];
99  }
100 }
__construct(ModuleDataSetupInterface $moduleDataSetup, CustomerSetupFactory $customerSetupFactory)