Skip to content

Commit 0070c73

Browse files
committed
MAGETWO-32116: Customer model and tables cleaning
1 parent 234d895 commit 0070c73

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,6 @@ public function setStoreId($storeId)
9696
return $this;
9797
}
9898

99-
/**
100-
* {@inheritdoc}
101-
* Redeclare method to disable entity_type_id filter
102-
*/
103-
protected function _initSelect()
104-
{
105-
$this->getSelect()->from(['e' => $this->getEntity()->getEntityTable()]);
106-
return $this;
107-
}
108-
10999
/**
110100
* Return current store id
111101
*

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ public function checkAttributeUniqueValue(AbstractAttribute $attribute, $object)
958958
);
959959
}
960960

961-
if (!$this->getEntityTable()) {
961+
if ($this->getEntityTable() == \Magento\Eav\Model\Entity::DEFAULT_ENTITY_TABLE) {
962962
$bind['entity_type_id'] = $this->getTypeId();
963963
$select->where('entity_type_id = :entity_type_id');
964964
}
@@ -1159,7 +1159,9 @@ public function save(\Magento\Framework\Object $object)
11591159
$this->loadAllAttributes($object);
11601160
}
11611161

1162-
if (!$this->getEntityTable() && !$object->getEntityTypeId()) {
1162+
if ($this->getEntityTable() == \Magento\Eav\Model\Entity::DEFAULT_ENTITY_TABLE
1163+
&& !$object->getEntityTypeId()
1164+
) {
11631165
$object->setEntityTypeId($this->getTypeId());
11641166
}
11651167

app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,6 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db
113113
*/
114114
protected $_universalFactory;
115115

116-
/**
117-
* Specific entity types which not required "entity_type_id" for select
118-
*
119-
* @var array
120-
*/
121-
protected $entityTypes = ['customer', 'customer_address'];
122-
123116
/**
124117
* @param \Magento\Core\Model\EntityFactory $entityFactory
125118
* @param \Psr\Log\LoggerInterface $logger
@@ -199,7 +192,7 @@ protected function _initSelect()
199192
{
200193
$this->getSelect()->from(['e' => $this->getEntity()->getEntityTable()]);
201194
$entity = $this->getEntity();
202-
if ($entity->getTypeId() && !in_array($entity->getType(), $this->entityTypes)) {
195+
if ($entity->getTypeId() && $entity->getEntityTable() == \Magento\Eav\Model\Entity::DEFAULT_ENTITY_TABLE ) {
203196
$this->addAttributeToFilter('entity_type_id', $this->getEntity()->getTypeId());
204197
}
205198
return $this;
@@ -1169,7 +1162,8 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
11691162
if (empty($attributeIds)) {
11701163
$attributeIds = $this->_selectAttributes;
11711164
}
1172-
$entityIdField = $this->getEntity()->getEntityIdField();
1165+
$entity = $this->getEntity();
1166+
$entityIdField = $entity->getEntityIdField();
11731167
$select = $this->getConnection()->select()->from(
11741168
$table,
11751169
[$entityIdField, 'attribute_id']
@@ -1181,10 +1175,10 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
11811175
$attributeIds
11821176
);
11831177

1184-
if (!in_array($this->getEntity()->getType(), $this->entityTypes)) {
1178+
if ($entity->getEntityTable() == \Magento\Eav\Model\Entity::DEFAULT_ENTITY_TABLE && $entity->getTypeId()) {
11851179
$select->where(
11861180
'entity_type_id =?',
1187-
$this->getEntity()->getTypeId()
1181+
$entity->getTypeId()
11881182
);
11891183
}
11901184
return $select;

0 commit comments

Comments
 (0)