Skip to content

Commit

Permalink
Fix issue 12479, customer custom attributes lost after save
Browse files Browse the repository at this point in the history
  • Loading branch information
Thundar committed Sep 7, 2018
1 parent 19bec6f commit 7965c9b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/code/Magento/Customer/Model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,21 @@ public function beforeDelete()
return parent::beforeDelete();
}

/**
* Processing object before save data
*
* @return $this
*/
public function beforeSave() {
// Need to use attribute set or future updates can cause data loss
if (!$this->getAttributeSetId()) {
$this->setAttributeSetId(
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER
);
}
return parent::beforeSave();
}

/**
* Processing object after save data
*
Expand Down

0 comments on commit 7965c9b

Please sign in to comment.