Skip to content

Commit c9c8d8a

Browse files
author
Richard Aspden
committed
Update for pull request #17772 - now using SimpleDataObjectConverter::snakeCaseToUpperCamelCase to maintain uniformity, and catch an additional case where the same issue occurred
1 parent 668e3e9 commit c9c8d8a

File tree

2 files changed

+4
-2
lines changed
  • app/code/Magento

2 files changed

+4
-2
lines changed

app/code/Magento/Catalog/Model/ProductLink/Repository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Catalog\Api\Data\ProductLinkExtensionFactory;
1111
use Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks as LinksInitializer;
1212
use Magento\Catalog\Model\Product\LinkTypeProvider;
13+
use Magento\Framework\Api\SimpleDataObjectConverter;
1314
use Magento\Framework\Exception\CouldNotSaveException;
1415
use Magento\Framework\Exception\NoSuchEntityException;
1516
use Magento\Framework\EntityManager\MetadataPool;
@@ -170,7 +171,7 @@ public function getList(\Magento\Catalog\Api\Data\ProductInterface $product)
170171
foreach ($item['custom_attributes'] as $option) {
171172
$name = $option['attribute_code'];
172173
$value = $option['value'];
173-
$setterName = 'set'.str_replace('_', '', ucwords($name, '_'));
174+
$setterName = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($name);
174175
// Check if setter exists
175176
if (method_exists($productLinkExtension, $setterName)) {
176177
call_user_func([$productLinkExtension, $setterName], $value);

app/code/Magento/GroupedProduct/Model/Product/Initialization/Helper/ProductLinks/Plugin/Grouped.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Catalog\Api\Data\ProductLinkExtensionFactory;
99
use Magento\Catalog\Api\Data\ProductLinkInterfaceFactory;
1010
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Framework\Api\SimpleDataObjectConverter;
1112
use Magento\Framework\Exception\NoSuchEntityException;
1213
use Magento\GroupedProduct\Model\Product\Type\Grouped as TypeGrouped;
1314

@@ -111,7 +112,7 @@ public function beforeInitializeLinks(
111112
foreach ($linkRaw['custom_attributes'] as $option) {
112113
$name = $option['attribute_code'];
113114
$value = $option['value'];
114-
$setterName = 'set' . ucfirst($name);
115+
$setterName = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($name);
115116
// Check if setter exists
116117
if (method_exists($productLinkExtension, $setterName)) {
117118
call_user_func([$productLinkExtension, $setterName], $value);

0 commit comments

Comments
 (0)