Skip to content

Commit b06b423

Browse files
author
Shkolyarenko, Serhiy(sshkolyarenko)
committed
Merge pull request #263 from magento-folks/PR-2.0.1
[2.0]Upgrade fixes
2 parents 4cae5d0 + b113d78 commit b06b423

File tree

1 file changed

+49
-45
lines changed

1 file changed

+49
-45
lines changed

app/code/Magento/Customer/Setup/UpgradeData.php

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,52 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
6060
/** @var CustomerSetup $customerSetup */
6161
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
6262

63+
if (version_compare($context->getVersion(), '2.0.6', '<')) {
64+
$customerSetup->updateEntityType(
65+
\Magento\Customer\Model\Customer::ENTITY,
66+
'entity_model',
67+
'Magento\Customer\Model\ResourceModel\Customer'
68+
);
69+
$customerSetup->updateEntityType(
70+
\Magento\Customer\Model\Customer::ENTITY,
71+
'increment_model',
72+
'Magento\Eav\Model\Entity\Increment\NumericValue'
73+
);
74+
$customerSetup->updateEntityType(
75+
\Magento\Customer\Model\Customer::ENTITY,
76+
'entity_attribute_collection',
77+
'Magento\Customer\Model\ResourceModel\Attribute\Collection'
78+
);
79+
$customerSetup->updateEntityType(
80+
'customer_address',
81+
'entity_model',
82+
'Magento\Customer\Model\ResourceModel\Address'
83+
);
84+
$customerSetup->updateEntityType(
85+
'customer_address',
86+
'entity_attribute_collection',
87+
'Magento\Customer\Model\ResourceModel\Address\Attribute\Collection'
88+
);
89+
$customerSetup->updateAttribute(
90+
'customer_address',
91+
'country_id',
92+
'source_model',
93+
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country'
94+
);
95+
$customerSetup->updateAttribute(
96+
'customer_address',
97+
'region',
98+
'backend_model',
99+
'Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region'
100+
);
101+
$customerSetup->updateAttribute(
102+
'customer_address',
103+
'region_id',
104+
'source_model',
105+
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region'
106+
);
107+
}
108+
63109
if (version_compare($context->getVersion(), '2.0.1', '<')) {
64110
$entityAttributes = [
65111
'customer' => [
@@ -240,51 +286,6 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
240286
];
241287
$this->upgradeAttributes($entityAttributes, $customerSetup);
242288
}
243-
if (version_compare($context->getVersion(), '2.0.6', '<')) {
244-
$customerSetup->updateEntityType(
245-
\Magento\Customer\Model\Customer::ENTITY,
246-
'entity_model',
247-
'Magento\Customer\Model\ResourceModel\Customer'
248-
);
249-
$customerSetup->updateEntityType(
250-
\Magento\Customer\Model\Customer::ENTITY,
251-
'increment_model',
252-
'Magento\Eav\Model\Entity\Increment\NumericValue'
253-
);
254-
$customerSetup->updateEntityType(
255-
\Magento\Customer\Model\Customer::ENTITY,
256-
'entity_attribute_collection',
257-
'Magento\Customer\Model\ResourceModel\Attribute\Collection'
258-
);
259-
$customerSetup->updateEntityType(
260-
'customer_address',
261-
'entity_model',
262-
'Magento\Customer\Model\ResourceModel\Address'
263-
);
264-
$customerSetup->updateEntityType(
265-
'customer_address',
266-
'entity_attribute_collection',
267-
'Magento\Customer\Model\ResourceModel\Address\Attribute\Collection'
268-
);
269-
$customerSetup->updateAttribute(
270-
'customer_address',
271-
'country_id',
272-
'source_model',
273-
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country'
274-
);
275-
$customerSetup->updateAttribute(
276-
'customer_address',
277-
'region',
278-
'backend_model',
279-
'Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region'
280-
);
281-
$customerSetup->updateAttribute(
282-
'customer_address',
283-
'region_id',
284-
'source_model',
285-
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region'
286-
);
287-
}
288289

289290
if (version_compare($context->getVersion(), '2.0.6', '<')) {
290291
$setup->getConnection()->delete(
@@ -332,6 +333,9 @@ private function upgradeHash($setup)
332333

333334
$customers = $setup->getConnection()->fetchAll($select);
334335
foreach ($customers as $customer) {
336+
if ($customer['password_hash'] === null) {
337+
continue;
338+
}
335339
list($hash, $salt) = explode(Encryptor::DELIMITER, $customer['password_hash']);
336340

337341
$newHash = $customer['password_hash'];

0 commit comments

Comments
 (0)