From 5a9c17f037bede56cab1d666144c0f46e1389c53 Mon Sep 17 00:00:00 2001 From: Andre Flitsch Date: Wed, 24 Oct 2018 11:37:58 +0200 Subject: [PATCH 1/2] Change DB type for temp tables to INNODB to prevent table crashes --- Entities/Model/ResourceModel/Entities.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Entities/Model/ResourceModel/Entities.php b/Entities/Model/ResourceModel/Entities.php index 8afcf6d..c0fc995 100644 --- a/Entities/Model/ResourceModel/Entities.php +++ b/Entities/Model/ResourceModel/Entities.php @@ -152,7 +152,7 @@ public function createTable($fields, $tableName) 'Is New' ); - $table->setOption('type', 'MYISAM'); + $table->setOption('type', 'INNODB'); $connection->createTable($table); @@ -375,7 +375,7 @@ public function matchEntity($tableName, $pimKey, $entityTable, $entityKey, $impo public function setValues($tableName, $entityTable, $values, $entityTypeId, $storeId, $mode = 1) { $connection = $this->getConnection(); - + foreach ($values as $code => $value) { if (($attribute = $this->getAttribute($code, $entityTypeId))) { if ($attribute['backend_type'] !== 'static') { From 75b2bf67114e813d43ffe5b182adc8c4addebf25 Mon Sep 17 00:00:00 2001 From: Andre Flitsch Date: Mon, 29 Jan 2024 15:33:24 +0100 Subject: [PATCH 2/2] Update Entities.php Fix bug where $attributes is not countable --- Entities/Model/ResourceModel/Entities.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Entities/Model/ResourceModel/Entities.php b/Entities/Model/ResourceModel/Entities.php index c0fc995..eb3e9af 100644 --- a/Entities/Model/ResourceModel/Entities.php +++ b/Entities/Model/ResourceModel/Entities.php @@ -471,7 +471,7 @@ public function getAttribute($code, $entityTypeId) ->where('attribute_code = ?', $code) ->limit(1) ); - return count($attribute) ? $attribute : false; + return is_array($attribute) ? count($attribute) ? $attribute : false : false ; } /** @@ -503,4 +503,4 @@ public function getColumnIdentifier($table, $identifier = 'entity_id') return $identifier; } -} \ No newline at end of file +}