Skip to content

Commit

Permalink
Merge branch 'release/v103.0.4' into 'master'
Browse files Browse the repository at this point in the history
release/v103.0.4 into master

See merge request agence-dnd/marketplace/magento-2/external/magento2-connector-community!22
  • Loading branch information
Rémi V committed Jul 25, 2022
2 parents 3894bb3 + a4c30db commit 94655a2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,9 @@

### Version 103.0.3 :
* Fix simple product association with configurable product when a variation from a two-level family variant is imported without the product model

### Version 103.0.4 :
* Fix "setRelated" temporary table name to unique value
* Fix product model variant change in `catalog_product_super_attribute` table
* Fix `Too few arguments to function Laminas\Diactoros\ResponseFactory::__construct()` issue by adding `nyholm/psr7` dependency
* Fix missing "$edition" variable in `Job/Product.php`
34 changes: 30 additions & 4 deletions Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -2198,10 +2198,34 @@ public function linkConfigurable()
continue;
}

/** @var array $attributes */
$attributes = explode(',', $row['_axis'] ?? '');
/** @var int $position */
$position = 0;
/** @var array $attributes */
$attributes = explode(',', $row['_axis'] ?? '');
/** @var array[] $productExistingSuperAttributes */
$existingSuperAttributes = $connection->fetchAll(
$connection->select()->from($productSuperAttrTable, ['attribute_id'])->where(
'product_id = ?',
$row[$pKeyColumn]
)
);
/** @var string[] $formattedExistingSuperAttributes */
$formattedExistingSuperAttributes = array_map('current', $existingSuperAttributes);

/** @var string $existingAttributeId */
foreach ($formattedExistingSuperAttributes as $existingAttributeId) {
if (in_array($existingAttributeId, $attributes)) {
continue;
}
// Remove "ghost" super attributes that exists into Magento but didn't into Akeneo
$remove = $connection->delete(
$productSuperAttrTable,
[
'product_id = ?' => $row[$pKeyColumn],
'attribute_id = ?' => $existingAttributeId,
]
);
}

/** @var int $id */
foreach ($attributes as $id) {
Expand Down Expand Up @@ -2341,7 +2365,9 @@ public function linkSimple()

/** @var Mysql $query */
$query = $connection->query($select);

/** @var string $edition */
$edition = $this->configHelper->getEdition();

if ($edition === Edition::SERENITY || $edition === Edition::GROWTH) {
/** @var string[] $filters */
$filters = [
Expand Down Expand Up @@ -2748,7 +2774,7 @@ public function setRelated(): void
}

// we create temp table to avoid FIND_IN_SET MySQL query which is a performance killer
$tempRelatedTable = 'tmp_akeneo_' . strtolower(__FUNCTION__) . '_' . ($this->family ?: uniqid());
$tempRelatedTable = 'tmp_akeneo_' . strtolower(__FUNCTION__) . '_' . uniqid();
$tempRelatedTable = substr($tempRelatedTable, 0, AdapterMysql::LENGTH_TABLE_NAME);
$connection->createTemporaryTable(
$connection->newTable($tempRelatedTable)
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"magento/module-store": ">=100.0.1",
"akeneo/api-php-client": "^9.0",
"symfony/http-client": "^5",
"http-interop/http-factory-guzzle": "^1.0"
"http-interop/http-factory-guzzle": "^1.0",
"nyholm/psr7": "^1.5"
},
"type": "magento2-module",
"version": "103.0.3",
"version": "103.0.4",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down

0 comments on commit 94655a2

Please sign in to comment.