Skip to content

Commit b24f7d6

Browse files
committed
MAGETWO-65366: [GitHub][PR] Set correct primary keys for temporary tables in product flat indexer #8589
- Merge Pull Request #8589 from jarnooravainen/magento2:patch-1
2 parents a005167 + e114337 commit b24f7d6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ public function build($storeId, $changedIds, $valueFieldSuffix)
7474
$attributes = $this->_productIndexerHelper->getAttributes();
7575
$eavAttributes = $this->_productIndexerHelper->getTablesStructure($attributes);
7676
$entityTableColumns = $eavAttributes[$entityTableName];
77+
$linkField = $this->getMetadataPool()
78+
->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)
79+
->getLinkField();
7780

7881
$temporaryEavAttributes = $eavAttributes;
7982

@@ -101,11 +104,11 @@ public function build($storeId, $changedIds, $valueFieldSuffix)
101104
$temporaryTableName = $this->_getTemporaryTableName($tableName);
102105

103106
//Add primary key to temporary table for increase speed of joins in future
104-
$this->_addPrimaryKeyToTable($temporaryTableName);
107+
$this->_addPrimaryKeyToTable($temporaryTableName, $linkField);
105108

106109
//Create temporary table for composite attributes
107110
if (isset($valueTables[$temporaryTableName . $valueFieldSuffix])) {
108-
$this->_addPrimaryKeyToTable($temporaryTableName . $valueFieldSuffix);
111+
$this->_addPrimaryKeyToTable($temporaryTableName . $valueFieldSuffix, $linkField);
109112
}
110113

111114
//Fill temporary tables with attributes grouped by it type

0 commit comments

Comments
 (0)