Created
May 24, 2019 08:46
-
-
Save Beagon/dab227e413ccccaedb846efff567550f to your computer and use it in GitHub Desktop.
MAGETWO-96908: Fix MySQL Syntax error on indexing of category flat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From dd98dde8e8ceaedc6afca34edb6f2a4c5b5fe931 Mon Sep 17 00:00:00 2001 | |
| From: Dmytro Horytskyi <[email protected]> | |
| Date: Wed, 5 Dec 2018 16:52:03 +0200 | |
| Subject: [PATCH 1/3] MAGETWO-96908: [2.3] Wrong attribute value in flat table | |
| --- | |
| .../Model/Indexer/Product/Flat/FlatTableBuilder.php | 2 +- | |
| 1 file changed, 1 insertion(+), 1 deletion(-) | |
| diff --git a/Model/Indexer/Product/Flat/FlatTableBuilder.php b/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| index e8a60d50405a..5e52101d4bba 100644 | |
| --- a/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| +++ b/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| @@ -365,7 +365,7 @@ protected function _updateTemporaryTableByStoreValues( | |
| [] | |
| )->columns( | |
| [$columnName => $this->_connection->getIfNullSql('ts.value', 't0.value')] | |
| - )->where($attributeCode . ' IS NOT NULL'); | |
| + )->where($columnName . ' IS NOT NULL'); | |
| if (!empty($changedIds)) { | |
| $select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds)); | |
| } | |
| From 2c5bf7d2f5ec3fd61a525234c1f717e7b32f7083 Mon Sep 17 00:00:00 2001 | |
| From: Dmytro Horytskyi <[email protected]> | |
| Date: Wed, 5 Dec 2018 16:57:44 +0200 | |
| Subject: [PATCH 2/3] MAGETWO-96908: [2.3] Wrong attribute value in flat table | |
| --- | |
| .../Model/Indexer/Product/Flat/FlatTableBuilder.php | 3 ++- | |
| 1 file changed, 2 insertions(+), 1 deletion(-) | |
| diff --git a/Model/Indexer/Product/Flat/FlatTableBuilder.php b/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| index 5e52101d4bba..99ff16a10994 100644 | |
| --- a/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| +++ b/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| @@ -11,6 +11,7 @@ | |
| /** | |
| * Class FlatTableBuilder | |
| + * | |
| * @SuppressWarnings(PHPMD.CouplingBetweenObjects) | |
| */ | |
| class FlatTableBuilder | |
| @@ -389,7 +390,7 @@ protected function _getTemporaryTableName($tableName) | |
| } | |
| /** | |
| - * Get MetadataPool | |
| + * Get metadata pool | |
| * | |
| * @return \Magento\Framework\EntityManager\MetadataPool | |
| */ | |
| From 829866193ac93d6404bf48d0322776d311328cfc Mon Sep 17 00:00:00 2001 | |
| From: Dmytro Horytskyi <[email protected]> | |
| Date: Thu, 27 Dec 2018 15:38:26 +0200 | |
| Subject: [PATCH 3/3] MAGETWO-96908: [2.3] Wrong attribute value in flat table | |
| --- | |
| .../Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php | 5 +++-- | |
| 1 file changed, 3 insertions(+), 2 deletions(-) | |
| diff --git a/Model/Indexer/Product/Flat/FlatTableBuilder.php b/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| index 99ff16a10994..a7273ff37860 100644 | |
| --- a/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| +++ b/Model/Indexer/Product/Flat/FlatTableBuilder.php | |
| @@ -355,6 +355,7 @@ protected function _updateTemporaryTableByStoreValues( | |
| //Update not simple attributes (eg. dropdown) | |
| $columnName = $attributeCode . $valueFieldSuffix; | |
| if (isset($flatColumns[$columnName])) { | |
| + $columnValue = $this->_connection->getIfNullSql('ts.value', 't0.value'); | |
| $select = $this->_connection->select(); | |
| $select->joinLeft( | |
| ['t0' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')], | |
| @@ -365,8 +366,8 @@ protected function _updateTemporaryTableByStoreValues( | |
| 'ts.option_id = et.' . $attributeCode . ' AND ts.store_id = ' . $storeId, | |
| [] | |
| )->columns( | |
| - [$columnName => $this->_connection->getIfNullSql('ts.value', 't0.value')] | |
| - )->where($columnName . ' IS NOT NULL'); | |
| + [$columnName => $columnValue] | |
| + )->where($columnValue . ' IS NOT NULL'); | |
| if (!empty($changedIds)) { | |
| $select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment