Skip to content

Commit 0965b37

Browse files
author
Oleksii Korshenko
authored
Merge pull request magento#156 from magento-sparta/MDVA-458
[SUPPORT] MDVA-458: Customer address is displayed incorrectly
2 parents 87b7b5f + e086bc2 commit 0965b37

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

app/code/Magento/Catalog/Setup/CategorySetup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function getDefaultEntities()
6767
{
6868
return [
6969
'catalog_category' => [
70+
'entity_type_id' => 3,
7071
'entity_model' => 'Magento\Catalog\Model\ResourceModel\Category',
7172
'attribute_model' => 'Magento\Catalog\Model\ResourceModel\Eav\Attribute',
7273
'table' => 'catalog_category_entity',
@@ -335,6 +336,7 @@ public function getDefaultEntities()
335336
],
336337
],
337338
'catalog_product' => [
339+
'entity_type_id' => 4,
338340
'entity_model' => 'Magento\Catalog\Model\ResourceModel\Product',
339341
'attribute_model' => 'Magento\Catalog\Model\ResourceModel\Eav\Attribute',
340342
'table' => 'catalog_product_entity',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function getDefaultEntities()
126126
{
127127
$entities = [
128128
'customer' => [
129+
'entity_type_id' => \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
129130
'entity_model' => 'Magento\Customer\Model\ResourceModel\Customer',
130131
'attribute_model' => 'Magento\Customer\Model\Attribute',
131132
'table' => 'customer_entity',
@@ -338,6 +339,7 @@ public function getDefaultEntities()
338339
],
339340
],
340341
'customer_address' => [
342+
'entity_type_id' => \Magento\Customer\Api\AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS,
341343
'entity_model' => 'Magento\Customer\Model\ResourceModel\Address',
342344
'attribute_model' => 'Magento\Customer\Model\Attribute',
343345
'table' => 'customer_address_entity',

app/code/Magento/Eav/Setup/EavSetup.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,21 @@ public function addEntityType($code, array $params)
192192
'additional_attribute_table' => $this->_getValue($params, 'additional_attribute_table'),
193193
'entity_attribute_collection' => $this->_getValue($params, 'entity_attribute_collection'),
194194
];
195+
if (isset($params['entity_type_id'])) {
196+
$data['entity_type_id'] = $params['entity_type_id'];
197+
}
195198

196199
if ($this->getEntityType($code, 'entity_type_id')) {
197200
$this->updateEntityType($code, $data);
198201
} else {
199202
$this->setup->getConnection()->insert($this->setup->getTable('eav_entity_type'), $data);
200203
}
201204

202-
$this->addAttributeSet($code, $this->_defaultAttributeSetName);
205+
if (isset($params['entity_type_id'])) {
206+
$this->addAttributeSet($code, $this->_defaultAttributeSetName, null, $params['entity_type_id']);
207+
} else {
208+
$this->addAttributeSet($code, $this->_defaultAttributeSetName);
209+
}
203210
$this->addAttributeGroup($code, $this->_defaultGroupName, $this->_generalGroupName);
204211

205212
return $this;
@@ -310,16 +317,21 @@ public function getAttributeSetSortOrder($entityTypeId, $sortOrder = null)
310317
* @param int|string $entityTypeId
311318
* @param string $name
312319
* @param int $sortOrder
320+
* @param int $setId
313321
* @return $this
314322
*/
315-
public function addAttributeSet($entityTypeId, $name, $sortOrder = null)
323+
public function addAttributeSet($entityTypeId, $name, $sortOrder = null, $setId = null)
316324
{
317325
$data = [
318326
'entity_type_id' => $this->getEntityTypeId($entityTypeId),
319327
'attribute_set_name' => $name,
320328
'sort_order' => $this->getAttributeSetSortOrder($entityTypeId, $sortOrder),
321329
];
322330

331+
if ($setId !== null) {
332+
$data['attribute_set_id'] = $setId;
333+
}
334+
323335
$setId = $this->getAttributeSet($entityTypeId, $name, 'attribute_set_id');
324336
if ($setId) {
325337
$this->updateAttributeSet($entityTypeId, $setId, $data);

app/code/Magento/Sales/Setup/SalesSetup.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,27 +214,31 @@ public function getDefaultEntities()
214214
{
215215
$entities = [
216216
'order' => [
217+
'entity_type_id' => 5,
217218
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order',
218219
'table' => 'sales_order',
219220
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',
220221
'increment_per_store' => true,
221222
'attributes' => [],
222223
],
223224
'invoice' => [
225+
'entity_type_id' => 6,
224226
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order\Invoice',
225227
'table' => 'sales_invoice',
226228
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',
227229
'increment_per_store' => true,
228230
'attributes' => [],
229231
],
230232
'creditmemo' => [
233+
'entity_type_id' => 7,
231234
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order\Creditmemo',
232235
'table' => 'sales_creditmemo',
233236
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',
234237
'increment_per_store' => true,
235238
'attributes' => [],
236239
],
237240
'shipment' => [
241+
'entity_type_id' => 8,
238242
'entity_model' => 'Magento\Sales\Model\ResourceModel\Order\Shipment',
239243
'table' => 'sales_shipment',
240244
'increment_model' => 'Magento\Eav\Model\Entity\Increment\NumericValue',

0 commit comments

Comments
 (0)