Skip to content

Commit

Permalink
Merge pull request #39 from akeneo/release/100.2.2
Browse files Browse the repository at this point in the history
Release/100.2.2
  • Loading branch information
Dnd-Gimix authored Sep 30, 2019
2 parents 91beb89 + 9c171d8 commit 9edbe8f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
* Use native Magento serializer
* Fix proxy class injection in command construct
* Fix association import when result is empty
* Fix url_key mapping and generation
* Fix url_key mapping and generation

### Version 100.2.2 :
* Fix issue when importing associations
* Improve attribute option import
2 changes: 1 addition & 1 deletion Helper/Import/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private function formatAssociations(array $values)
* @var array $product
*/
foreach ($types as $key => $products) {
if (empty($products)) {
if (empty(array_filter($products))) {
continue;
}
/** @var string $name */
Expand Down
24 changes: 22 additions & 2 deletions Job/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ class Option extends Import
* @var TypeListInterface $cacheTypeList
*/
protected $cacheTypeList;
/**
* This variable contains attributes from an API call
*
* @var PageInterface $attributes
*/
protected $attributes;

/**
* Option constructor
Expand Down Expand Up @@ -144,7 +150,7 @@ public function __construct(
public function createTable()
{
/** @var PageInterface $attributes */
$attributes = $this->akeneoClient->getAttributeApi()->all();
$attributes = $this->getAllAttributes();
/** @var bool $hasOptions */
$hasOptions = false;
/** @var array $attribute */
Expand Down Expand Up @@ -189,7 +195,7 @@ public function insertData()
/** @var string|int $paginationSize */
$paginationSize = $this->configHelper->getPanigationSize();
/** @var PageInterface $attributes */
$attributes = $this->akeneoClient->getAttributeApi()->all();
$attributes = $this->getAllAttributes();
/** @var int $lines */
$lines = 0;
/** @var array $attribute */
Expand Down Expand Up @@ -352,4 +358,18 @@ protected function processAttributeOption($attributeCode, $paginationSize)

return $index;
}

/**
* Get all attributes from the API
*
* @return ResourceCursorInterface|mixed
*/
public function getAllAttributes()
{
if (!$this->attributes) {
$this->attributes = $this->akeneoClient->getAttributeApi()->all();
}

return $this->attributes;
}
}
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.1",
"version": "100.2.2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down

0 comments on commit 9edbe8f

Please sign in to comment.