Skip to content

Commit

Permalink
Merge pull request magento#156 from magento-sparta/MDVA-458
Browse files Browse the repository at this point in the history
[SUPPORT] MDVA-458: Customer address is displayed incorrectly
  • Loading branch information
Oleksii Korshenko authored Jul 15, 2016
2 parents 87b7b5f + e086bc2 commit 0965b37
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/code/Magento/Catalog/Setup/CategorySetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function getDefaultEntities()
{
return [
'catalog_category' => [
'entity_type_id' => 3,
'entity_model' => 'Magento\Catalog\Model\ResourceModel\Category',
'attribute_model' => 'Magento\Catalog\Model\ResourceModel\Eav\Attribute',
'table' => 'catalog_category_entity',
Expand Down Expand Up @@ -335,6 +336,7 @@ public function getDefaultEntities()
],
],
'catalog_product' => [
'entity_type_id' => 4,
'entity_model' => 'Magento\Catalog\Model\ResourceModel\Product',
'attribute_model' => 'Magento\Catalog\Model\ResourceModel\Eav\Attribute',
'table' => 'catalog_product_entity',
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Customer/Setup/CustomerSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function getDefaultEntities()
{
$entities = [
'customer' => [
'entity_type_id' => \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
'entity_model' => 'Magento\Customer\Model\ResourceModel\Customer',
'attribute_model' => 'Magento\Customer\Model\Attribute',
'table' => 'customer_entity',
Expand Down Expand Up @@ -338,6 +339,7 @@ public function getDefaultEntities()
],
],
'customer_address' => [
'entity_type_id' => \Magento\Customer\Api\AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS,
'entity_model' => 'Magento\Customer\Model\ResourceModel\Address',
'attribute_model' => 'Magento\Customer\Model\Attribute',
'table' => 'customer_address_entity',
Expand Down
16 changes: 14 additions & 2 deletions app/code/Magento/Eav/Setup/EavSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,21 @@ public function addEntityType($code, array $params)
'additional_attribute_table' => $this->_getValue($params, 'additional_attribute_table'),
'entity_attribute_collection' => $this->_getValue($params, 'entity_attribute_collection'),
];
if (isset($params['entity_type_id'])) {
$data['entity_type_id'] = $params['entity_type_id'];
}

if ($this->getEntityType($code, 'entity_type_id')) {
$this->updateEntityType($code, $data);
} else {
$this->setup->getConnection()->insert($this->setup->getTable('eav_entity_type'), $data);
}

$this->addAttributeSet($code, $this->_defaultAttributeSetName);
if (isset($params['entity_type_id'])) {
$this->addAttributeSet($code, $this->_defaultAttributeSetName, null, $params['entity_type_id']);
} else {
$this->addAttributeSet($code, $this->_defaultAttributeSetName);
}
$this->addAttributeGroup($code, $this->_defaultGroupName, $this->_generalGroupName);

return $this;
Expand Down Expand Up @@ -310,16 +317,21 @@ public function getAttributeSetSortOrder($entityTypeId, $sortOrder = null)
* @param int|string $entityTypeId
* @param string $name
* @param int $sortOrder
* @param int $setId
* @return $this
*/
public function addAttributeSet($entityTypeId, $name, $sortOrder = null)
public function addAttributeSet($entityTypeId, $name, $sortOrder = null, $setId = null)
{
$data = [
'entity_type_id' => $this->getEntityTypeId($entityTypeId),
'attribute_set_name' => $name,
'sort_order' => $this->getAttributeSetSortOrder($entityTypeId, $sortOrder),
];

if ($setId !== null) {
$data['attribute_set_id'] = $setId;
}

$setId = $this->getAttributeSet($entityTypeId, $name, 'attribute_set_id');
if ($setId) {
$this->updateAttributeSet($entityTypeId, $setId, $data);
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Sales/Setup/SalesSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,31 @@ public function getDefaultEntities()
{
$entities = [
'order' => [
'entity_type_id' => 5,
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order',
'table' => 'sales_order',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',
'increment_per_store' => true,
'attributes' => [],
],
'invoice' => [
'entity_type_id' => 6,
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order\Invoice',
'table' => 'sales_invoice',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',
'increment_per_store' => true,
'attributes' => [],
],
'creditmemo' => [
'entity_type_id' => 7,
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order\Creditmemo',
'table' => 'sales_creditmemo',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',
'increment_per_store' => true,
'attributes' => [],
],
'shipment' => [
'entity_type_id' => 8,
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order\Shipment',
'table' => 'sales_shipment',
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',
Expand Down

0 comments on commit 0965b37

Please sign in to comment.