Skip to content

Commit 9fe8d7d

Browse files
mohaelmrabet-sqlisumesh-GL
authored andcommitted
Fix: preserve existing store labels when updating attribute option via API (issue #40093) - Updated
1 parent a7b8aeb commit 9fe8d7d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Eav\Model\AttributeRepository;
1515
use Magento\Eav\Model\ResourceModel\Entity\Attribute;
1616
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Option;
17+
use Magento\Framework\App\ObjectManager;
1718
use Magento\Framework\Exception\InputException;
1819
use Magento\Framework\Exception\NoSuchEntityException;
1920
use Magento\Framework\Exception\StateException;
@@ -41,17 +42,17 @@ class OptionManagement implements AttributeOptionManagementInterface, AttributeO
4142
/**
4243
* @param AttributeRepository $attributeRepository
4344
* @param Attribute $resourceModel
44-
* @param Option $optionResource
45+
* @param Option|null $optionResource
4546
* @codeCoverageIgnore
4647
*/
4748
public function __construct(
4849
AttributeRepository $attributeRepository,
4950
Attribute $resourceModel,
50-
Attribute\Option $optionResource
51+
?Attribute\Option $optionResource = null
5152
) {
5253
$this->attributeRepository = $attributeRepository;
5354
$this->resourceModel = $resourceModel;
54-
$this->optionResource = $optionResource;
55+
$this->optionResource = $optionResource ?: ObjectManager::getInstance()->get(Attribute\Option::class);
5556
}
5657

5758
/**

0 commit comments

Comments
 (0)