Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RemoveCheckoutRegisterAndUpdateAttributes.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Customer\Setup\CustomerSetupFactory;
26 
32 {
36  private $moduleDataSetup;
37 
41  private $customerSetupFactory;
42 
48  public function __construct(
49  ModuleDataSetupInterface $moduleDataSetup,
50  CustomerSetupFactory $customerSetupFactory
51  ) {
52  $this->moduleDataSetup = $moduleDataSetup;
53  $this->customerSetupFactory = $customerSetupFactory;
54  }
55 
59  public function apply()
60  {
61  $this->moduleDataSetup->getConnection()->delete(
62  $this->moduleDataSetup->getTable('customer_form_attribute'),
63  ['form_code = ?' => 'checkout_register']
64  );
65  $customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
66  $customerSetup->updateEntityType(
68  'entity_model',
69  \Magento\Customer\Model\ResourceModel\Customer::class
70  );
71  $customerSetup->updateEntityType(
73  'increment_model',
74  \Magento\Eav\Model\Entity\Increment\NumericValue::class
75  );
76  $customerSetup->updateEntityType(
78  'entity_attribute_collection',
79  \Magento\Customer\Model\ResourceModel\Attribute\Collection::class
80  );
81  $customerSetup->updateEntityType(
82  'customer_address',
83  'entity_model',
84  \Magento\Customer\Model\ResourceModel\Address::class
85  );
86  $customerSetup->updateEntityType(
87  'customer_address',
88  'entity_attribute_collection',
89  \Magento\Customer\Model\ResourceModel\Address\Attribute\Collection::class
90  );
91  $customerSetup->updateAttribute(
92  'customer_address',
93  'country_id',
94  'source_model',
95  \Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country::class
96  );
97  $customerSetup->updateAttribute(
98  'customer_address',
99  'region',
100  'backend_model',
101  \Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region::class
102  );
103  $customerSetup->updateAttribute(
104  'customer_address',
105  'region_id',
106  'source_model',
107  \Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region::class
108  );
109  }
110 
114  public static function getDependencies()
115  {
116  return [
117  UpgradePasswordHashAndAddress::class,
118  ];
119  }
120 
124  public static function getVersion()
125  {
126  return '2.0.6';
127  }
128 
132  public function getAliases()
133  {
134  return [];
135  }
136 }
__construct(ModuleDataSetupInterface $moduleDataSetup, CustomerSetupFactory $customerSetupFactory)