Skip to content

Commit

Permalink
Merge pull request magento#5 from magento-troll/develop
Browse files Browse the repository at this point in the history
SF API test for categories and product dynamic attributes
  • Loading branch information
mslabko authored Oct 22, 2020
2 parents 9a99ccb + fda3f72 commit 95e5ddb
Show file tree
Hide file tree
Showing 32 changed files with 1,048 additions and 560 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@
*/
class DynamicAttribute implements DataMapperInterface
{
/**
* @var array
*/
private $attributePool;

/**
* @param array $attributePool
*/
public function __construct(array $attributePool)
{
$this->attributePool = $attributePool;
}

/**
* @inheritDoc
*/
Expand All @@ -32,16 +19,17 @@ public function map(array $productData): array
$dynamicAttributes = [];

foreach ($productData['attributes'] ?? [] as $attribute) {
$attributeType = $this->attributePool[$attribute['type']];
if (!$attributeType instanceof \Magento\CatalogMessageBroker\Model\DataMapper\AttributeTypeInterface) {
continue;
$values = [];
foreach ($attribute['value'] ?? [] as $option) {
$values[] = $option['value'];
}
$dynamicAttributes[] = [
'code' => $attribute['attribute_code'],
'value' => $attributeType->getAttribute($attribute),
'type' => $attribute['type'],
'values' => $values
];
}

return $dynamicAttributes ? ['dynamic_attributes' => $dynamicAttributes] : [];
return $dynamicAttributes ? ['attributes' => $dynamicAttributes] : [];
}
}

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions app/code/Magento/CatalogMessageBroker/Model/DataMapper/Type.php

This file was deleted.

11 changes: 0 additions & 11 deletions app/code/Magento/CatalogMessageBroker/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@
</argument>
</arguments>
</type>
<type name="Magento\CatalogMessageBroker\Model\DataMapper\DynamicAttribute">
<arguments>
<argument name="attributePool" xsi:type="array">
<item name="boolean" xsi:type="object">Magento\CatalogMessageBroker\Model\DataMapper\BooleanType</item>
<item name="select" xsi:type="object">Magento\CatalogMessageBroker\Model\DataMapper\SelectOptionType</item>
<item name="text" xsi:type="object">Magento\CatalogMessageBroker\Model\DataMapper\Type</item>
<item name="price" xsi:type="object">Magento\CatalogMessageBroker\Model\DataMapper\Type</item>
<item name="multiselect" xsi:type="object">Magento\CatalogMessageBroker\Model\DataMapper\MultiselectOptionType</item>
</argument>
</arguments>
</type>
<type name="Magento\CatalogMessageBroker\Model\MessageBus\ConsumerEventInterfaceFactory">
<arguments>
<argument name="eventTypeMap" xsi:type="array">
Expand Down
Loading

0 comments on commit 95e5ddb

Please sign in to comment.