File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Catalog/Model/ProductLink
GroupedProduct/Model/Product/Initialization/Helper/ProductLinks/Plugin Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 11
11
use Magento \Catalog \Api \Data \ProductLinkExtensionFactory ;
12
12
use Magento \Catalog \Model \Product \Initialization \Helper \ProductLinks as LinksInitializer ;
13
13
use Magento \Catalog \Model \Product \LinkTypeProvider ;
14
+ use Magento \Framework \Api \SimpleDataObjectConverter ;
14
15
use Magento \Framework \Exception \CouldNotSaveException ;
15
16
use Magento \Framework \Exception \NoSuchEntityException ;
16
17
use Magento \Framework \EntityManager \MetadataPool ;
@@ -178,7 +179,7 @@ public function getList(\Magento\Catalog\Api\Data\ProductInterface $product)
178
179
foreach ($ item ['custom_attributes ' ] as $ option ) {
179
180
$ name = $ option ['attribute_code ' ];
180
181
$ value = $ option ['value ' ];
181
- $ setterName = 'set ' . str_replace ( ' _ ' , '' , ucwords ($ name, ' _ ' ) );
182
+ $ setterName = 'set ' . SimpleDataObjectConverter:: snakeCaseToUpperCamelCase ($ name );
182
183
// Check if setter exists
183
184
if (method_exists ($ productLinkExtension , $ setterName )) {
184
185
call_user_func ([$ productLinkExtension , $ setterName ], $ value );
Original file line number Diff line number Diff line change 8
8
use Magento \Catalog \Api \Data \ProductLinkExtensionFactory ;
9
9
use Magento \Catalog \Api \Data \ProductLinkInterfaceFactory ;
10
10
use Magento \Catalog \Api \ProductRepositoryInterface ;
11
+ use Magento \Framework \Api \SimpleDataObjectConverter ;
11
12
use Magento \GroupedProduct \Model \Product \Type \Grouped as TypeGrouped ;
12
13
13
14
/**
@@ -107,7 +108,7 @@ public function beforeInitializeLinks(
107
108
foreach ($ linkRaw ['custom_attributes ' ] as $ option ) {
108
109
$ name = $ option ['attribute_code ' ];
109
110
$ value = $ option ['value ' ];
110
- $ setterName = 'set ' . ucfirst ($ name );
111
+ $ setterName = 'set ' . SimpleDataObjectConverter:: snakeCaseToUpperCamelCase ($ name );
111
112
// Check if setter exists
112
113
if (method_exists ($ productLinkExtension , $ setterName )) {
113
114
call_user_func ([$ productLinkExtension , $ setterName ], $ value );
You can’t perform that action at this time.
0 commit comments