Skip to content

Commit

Permalink
Merge pull request #263 from magento-folks/PR-2.0.1
Browse files Browse the repository at this point in the history
[2.0]Upgrade fixes
  • Loading branch information
Shkolyarenko, Serhiy(sshkolyarenko) committed Dec 22, 2015
2 parents 4cae5d0 + b113d78 commit b06b423
Showing 1 changed file with 49 additions and 45 deletions.
94 changes: 49 additions & 45 deletions app/code/Magento/Customer/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,52 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
/** @var CustomerSetup $customerSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

if (version_compare($context->getVersion(), '2.0.6', '<')) {
$customerSetup->updateEntityType(
\Magento\Customer\Model\Customer::ENTITY,
'entity_model',
'Magento\Customer\Model\ResourceModel\Customer'
);
$customerSetup->updateEntityType(
\Magento\Customer\Model\Customer::ENTITY,
'increment_model',
'Magento\Eav\Model\Entity\Increment\NumericValue'
);
$customerSetup->updateEntityType(
\Magento\Customer\Model\Customer::ENTITY,
'entity_attribute_collection',
'Magento\Customer\Model\ResourceModel\Attribute\Collection'
);
$customerSetup->updateEntityType(
'customer_address',
'entity_model',
'Magento\Customer\Model\ResourceModel\Address'
);
$customerSetup->updateEntityType(
'customer_address',
'entity_attribute_collection',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Collection'
);
$customerSetup->updateAttribute(
'customer_address',
'country_id',
'source_model',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country'
);
$customerSetup->updateAttribute(
'customer_address',
'region',
'backend_model',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region'
);
$customerSetup->updateAttribute(
'customer_address',
'region_id',
'source_model',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region'
);
}

if (version_compare($context->getVersion(), '2.0.1', '<')) {
$entityAttributes = [
'customer' => [
Expand Down Expand Up @@ -240,51 +286,6 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
];
$this->upgradeAttributes($entityAttributes, $customerSetup);
}
if (version_compare($context->getVersion(), '2.0.6', '<')) {
$customerSetup->updateEntityType(
\Magento\Customer\Model\Customer::ENTITY,
'entity_model',
'Magento\Customer\Model\ResourceModel\Customer'
);
$customerSetup->updateEntityType(
\Magento\Customer\Model\Customer::ENTITY,
'increment_model',
'Magento\Eav\Model\Entity\Increment\NumericValue'
);
$customerSetup->updateEntityType(
\Magento\Customer\Model\Customer::ENTITY,
'entity_attribute_collection',
'Magento\Customer\Model\ResourceModel\Attribute\Collection'
);
$customerSetup->updateEntityType(
'customer_address',
'entity_model',
'Magento\Customer\Model\ResourceModel\Address'
);
$customerSetup->updateEntityType(
'customer_address',
'entity_attribute_collection',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Collection'
);
$customerSetup->updateAttribute(
'customer_address',
'country_id',
'source_model',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country'
);
$customerSetup->updateAttribute(
'customer_address',
'region',
'backend_model',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region'
);
$customerSetup->updateAttribute(
'customer_address',
'region_id',
'source_model',
'Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region'
);
}

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

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

$newHash = $customer['password_hash'];
Expand Down

0 comments on commit b06b423

Please sign in to comment.