Skip to content

Commit aaf5b64

Browse files
Update TableBuilder.php
Fix to be compatible with both CE and EE.
1 parent 7ea2238 commit aaf5b64

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ 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()->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)->getLinkField();
7778

7879
$temporaryEavAttributes = $eavAttributes;
7980

@@ -101,11 +102,11 @@ public function build($storeId, $changedIds, $valueFieldSuffix)
101102
$temporaryTableName = $this->_getTemporaryTableName($tableName);
102103

103104
//Add primary key to temporary table for increase speed of joins in future
104-
$this->_addPrimaryKeyToTable($temporaryTableName, 'row_id');
105+
$this->_addPrimaryKeyToTable($temporaryTableName, $linkField);
105106

106107
//Create temporary table for composite attributes
107108
if (isset($valueTables[$temporaryTableName . $valueFieldSuffix])) {
108-
$this->_addPrimaryKeyToTable($temporaryTableName . $valueFieldSuffix, 'row_id');
109+
$this->_addPrimaryKeyToTable($temporaryTableName . $valueFieldSuffix, $linkField);
109110
}
110111

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

0 commit comments

Comments
 (0)