Skip to content

Commit fede048

Browse files
committed
MC-18701: API Attribute Option update creates same value multiple times
1 parent 82f2be6 commit fede048

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,16 @@ public function __construct(
4141
}
4242

4343
/**
44-
* @inheritdoc
44+
* Add option to attribute.
45+
*
46+
* @param int $entityType
47+
* @param string $attributeCode
48+
* @param \Magento\Eav\Api\Data\AttributeOptionInterface $option
49+
* @return string
50+
* @throws InputException
51+
* @throws NoSuchEntityException
52+
* @throws StateException
53+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
4554
*/
4655
public function add($entityType, $attributeCode, $option)
4756
{
@@ -148,7 +157,7 @@ public function getItems($entityType, $attributeCode)
148157
* @param EavAttributeInterface $attribute
149158
* @param int $optionId
150159
* @return void
151-
*@throws NoSuchEntityException
160+
* @throws NoSuchEntityException
152161
*/
153162
protected function validateOption($attribute, $optionId)
154163
{

dev/tests/integration/testsuite/Magento/Swatches/Model/SwatchAttributeOptionAddTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testSwatchOptionAdd()
3636
$attribute = $this->objectManager
3737
->create(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
3838
->load('color_swatch', 'attribute_code');
39-
$optionsPerAttribute = 3;
39+
$optionsPerAttribute = 4;
4040

4141
$data['options']['option'] = array_reduce(
4242
range(10, $optionsPerAttribute),

0 commit comments

Comments
 (0)