Skip to content

Commit 237f56a

Browse files
committed
Fixing Snake Case To Camel Case
1 parent 6c529ec commit 237f56a

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

app/code/Magento/Signifyd/Model/CaseServices/UpdatingService.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\Signifyd\Model\CaseServices;
77

8+
use Magento\Framework\Api\SimpleDataObjectConverter;
89
use Magento\Framework\Exception\LocalizedException;
9-
use Magento\Framework\Exception\NotFoundException;
1010
use Magento\Signifyd\Api\CaseRepositoryInterface;
1111
use Magento\Signifyd\Api\Data\CaseInterface;
1212
use Magento\Signifyd\Model\CommentsHistoryUpdater;
@@ -73,7 +73,6 @@ public function __construct(
7373
* @param CaseInterface $case
7474
* @param array $data
7575
* @return void
76-
* @throws NotFoundException
7776
* @throws LocalizedException
7877
*/
7978
public function update(CaseInterface $case, array $data)
@@ -111,7 +110,7 @@ private function setCaseData(CaseInterface $case, array $data)
111110
'orderId'
112111
];
113112
foreach ($data as $key => $value) {
114-
$methodName = 'set' . ucfirst($key);
113+
$methodName = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key);
115114
if (!in_array($key, $notResolvedKeys) && method_exists($case, $methodName)) {
116115
call_user_func([$case, $methodName], $value);
117116
}

app/code/Magento/Webapi/Controller/Rest/ParamsOverrider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function isPropertyDeclaredInDataObject(
197197
$index = array_search($serviceMethodParamName, array_column($methodParams, 'name'));
198198
if ($index !== false) {
199199
$paramObjectType = $methodParams[$index][MethodsMap::METHOD_META_TYPE];
200-
$setter = 'set' . ucfirst(SimpleDataObjectConverter::snakeCaseToCamelCase($objectProperty));
200+
$setter = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($objectProperty);
201201
if (array_key_exists(
202202
$setter,
203203
$this->getMethodsMap()->getMethodsMap($paramObjectType)

lib/internal/Magento/Framework/Api/SimpleDataObjectConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public static function snakeCaseToUpperCamelCase($input)
156156
*/
157157
public static function snakeCaseToCamelCase($input)
158158
{
159-
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input))));
159+
return lcfirst(self::snakeCaseToUpperCamelCase($input));
160160
}
161161

162162
/**

lib/internal/Magento/Framework/App/Request/DataPersistor.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Framework\App\Request;
77

8+
use Magento\Framework\Api\SimpleDataObjectConverter;
89
use Magento\Framework\Session\SessionManagerInterface;
910

1011
class DataPersistor implements DataPersistorInterface
@@ -32,7 +33,7 @@ public function __construct(
3233
*/
3334
public function set($key, $data)
3435
{
35-
$method = 'set' . ucfirst($key) . 'Data';
36+
$method = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key) . 'Data';
3637
call_user_func_array([$this->session, $method], [$data]);
3738
}
3839

@@ -44,7 +45,7 @@ public function set($key, $data)
4445
*/
4546
public function get($key)
4647
{
47-
$method = 'get' . ucfirst($key) . 'Data';
48+
$method = 'get' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key) . 'Data';
4849
return call_user_func_array([$this->session, $method], []);
4950
}
5051

@@ -56,7 +57,7 @@ public function get($key)
5657
*/
5758
public function clear($key)
5859
{
59-
$method = 'uns' . ucfirst($key) . 'Data';
60+
$method = 'uns' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key) . 'Data';
6061
call_user_func_array([$this->session, $method], []);
6162
}
6263
}

0 commit comments

Comments
 (0)