Skip to content

Commit dbc3710

Browse files
author
Stanislav Idolov
authored
ENGCOM-2980: #18009: [Forwardport] Cannot create a numeric value attribute option using the REST API. #2159
2 parents 4701454 + 8c35df8 commit dbc3710

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function validateOption($attribute, $optionId)
153153
*/
154154
private function getOptionId(\Magento\Eav\Api\Data\AttributeOptionInterface $option) : string
155155
{
156-
return $option->getValue() ?: 'new_option';
156+
return 'id_' . ($option->getValue() ?: 'new_option');
157157
}
158158

159159
/**

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public function addDataProvider()
111111
'option_with_value_node_that_starts_with_a_number' => [
112112
array_merge($optionPayload, [AttributeOptionInterface::VALUE => '123_some_text'])
113113
],
114+
'option_with_value_node_that_is_a_number' => [
115+
array_merge($optionPayload, [AttributeOptionInterface::VALUE => '123'])
116+
],
114117

115118
];
116119
}

0 commit comments

Comments
 (0)