Skip to content

Commit

Permalink
Merge pull request #58 from akeneo/release/100.2.4
Browse files Browse the repository at this point in the history
Release/100.2.4
  • Loading branch information
Dnd-Gimix authored Oct 16, 2019
2 parents 98fb417 + 6e2472b commit 5e81379
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@
* Fix missing where statement on delete in website association feature
* Fix product website request if attribute is not filled in Akeneo
* Fix duplicate node in config.xml file
* Add check on family label to prevent import error on duplicate labels in Akeneo
* Add check on family label to prevent import error on duplicate labels in Akeneo

### Version 100.2.4 :
* Fix import command description
* Convert uppercase attribute mapping to lowercase
* Set import job response after step finish events
9 changes: 5 additions & 4 deletions Console/Command/AkeneoConnectorImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ public function __construct(
protected function configure()
{
$this->setName('akeneo_connector:import')->setDescription('Import Akeneo data to Magento')->addOption(
self::IMPORT_CODE,
null,
InputOption::VALUE_REQUIRED
);
self::IMPORT_CODE,
null,
InputOption::VALUE_REQUIRED,
'Code of import job to run. To run multiple jobs consecutively, use comma-separated import job codes'
);
}

/**
Expand Down
25 changes: 22 additions & 3 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,7 @@ public function isCategoryUsedInProductUrl($storeId = null)
public function isUrlKeyMapped()
{
/** @var mixed $matches */
$matches = $this->scopeConfig->getValue(self::PRODUCT_ATTRIBUTE_MAPPING);
/** @var mixed[] $matches */
$matches = $this->serializer->unserialize($matches);
$matches = $this->getAttributeMapping();
if (!is_array($matches)) {
return false;
}
Expand All @@ -764,4 +762,25 @@ public function isUrlKeyMapped()

return false;
}

/**
* Get the attribute mapping, with lowered values
*
* @return mixed
*/
public function getAttributeMapping()
{
/** @var mixed $matches */
$matches = $this->scopeConfig->getValue(self::PRODUCT_ATTRIBUTE_MAPPING);
$matches = $this->serializer->unserialize($matches);
/** @var mixed $loweredMatchs */
$loweredMatches = [];
/** @var string[] $match */
foreach ($matches as $match) {
$match = array_map('strtolower', $match);
$loweredMatches[] = $match;
}

return $loweredMatches;
}
}
4 changes: 1 addition & 3 deletions Job/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,14 @@ public function execute()
$this->stop(true);
$this->setMessage($exception->getMessage());
}
/** @var array $response */
$response = $this->getResponse();

$this->eventManager->dispatch('akeneo_connector_import_step_finish', ['import' => $this]);
$this->eventManager->dispatch(
'akeneo_connector_import_step_finish_'.strtolower($this->getCode()),
['import' => $this]
);

return $response;
return $this->getResponse();
}

/**
Expand Down
3 changes: 1 addition & 2 deletions Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,7 @@ public function addRequiredData()
}

/** @var string|array $matches */
$matches = $this->scopeConfig->getValue(ConfigHelper::PRODUCT_ATTRIBUTE_MAPPING);
$matches = $this->serializer->unserialize($matches);
$matches = $this->configHelper->getAttributeMapping();
if (!is_array($matches)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"php-http/guzzle6-adapter": "^1.1"
},
"type": "magento2-module",
"version": "100.2.3",
"version": "100.2.4",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down

0 comments on commit 5e81379

Please sign in to comment.