@@ -293,43 +293,42 @@ protected function _createFromArray($className, $data)
293
293
// Converts snake_case to uppercase CamelCase to help form getter/setter method names
294
294
// This use case is for REST only. SOAP request data is already camel cased
295
295
$ camelCaseProperty = SimpleDataObjectConverter::snakeCaseToUpperCamelCase ($ propertyName );
296
- $ methodName = 'get ' .$ camelCaseProperty ;
297
296
try {
298
297
$ methodName = $ this ->getNameFinder ()->getGetterMethodName ($ class , $ camelCaseProperty );
299
- } catch (\LogicException $ e ) {
300
- $ this ->processInputErrorForNestedSet ([$ camelCaseProperty ]);
301
- }
302
- if (!isset ($ this ->methodReflectionStorage [$ className . $ methodName ])) {
303
- $ this ->methodReflectionStorage [$ className . $ methodName ] = $ class ->getMethod ($ methodName );
304
- }
305
- $ methodReflection = $ this ->methodReflectionStorage [$ className . $ methodName ];
306
- if ($ methodReflection ->isPublic ()) {
307
- $ returnType = $ this ->typeProcessor ->getGetterReturnType ($ methodReflection )['type ' ];
308
- try {
309
- $ setterName = $ this ->getNameFinder ()->getSetterMethodName ($ class , $ camelCaseProperty );
310
- } catch (\Exception $ e ) {
311
- if (empty ($ value )) {
312
- continue ;
313
- } else {
314
- throw $ e ;
315
- }
298
+ if (!isset ($ this ->methodReflectionStorage [$ className . $ methodName ])) {
299
+ $ this ->methodReflectionStorage [$ className . $ methodName ] = $ class ->getMethod ($ methodName );
316
300
}
317
- try {
318
- if ($ camelCaseProperty === 'CustomAttributes ' ) {
319
- $ setterValue = $ this ->convertCustomAttributeValue ($ value , $ className );
320
- } else {
321
- $ setterValue = $ this ->convertValue ($ value , $ returnType );
301
+ $ methodReflection = $ this ->methodReflectionStorage [$ className . $ methodName ];
302
+ if ($ methodReflection ->isPublic ()) {
303
+ $ returnType = $ this ->typeProcessor ->getGetterReturnType ($ methodReflection )['type ' ];
304
+ try {
305
+ $ setterName = $ this ->getNameFinder ()->getSetterMethodName ($ class , $ camelCaseProperty );
306
+ } catch (\Exception $ e ) {
307
+ if (empty ($ value )) {
308
+ continue ;
309
+ } else {
310
+ throw $ e ;
311
+ }
322
312
}
323
- } catch (SerializationException $ e ) {
324
- throw new SerializationException (
325
- new Phrase (
326
- 'Error occurred during "%field_name" processing. %details ' ,
327
- ['field_name ' => $ propertyName , 'details ' => $ e ->getMessage ()]
328
- )
329
- );
313
+ try {
314
+ if ($ camelCaseProperty === 'CustomAttributes ' ) {
315
+ $ setterValue = $ this ->convertCustomAttributeValue ($ value , $ className );
316
+ } else {
317
+ $ setterValue = $ this ->convertValue ($ value , $ returnType );
318
+ }
319
+ } catch (SerializationException $ e ) {
320
+ throw new SerializationException (
321
+ new Phrase (
322
+ 'Error occurred during "%field_name" processing. %details ' ,
323
+ ['field_name ' => $ propertyName , 'details ' => $ e ->getMessage ()]
324
+ )
325
+ );
326
+ }
327
+ $ this ->serviceInputValidator ->validateEntityValue ($ object , $ propertyName , $ setterValue );
328
+ $ object ->{$ setterName }($ setterValue );
330
329
}
331
- $ this -> serviceInputValidator -> validateEntityValue ( $ object , $ propertyName , $ setterValue );
332
- $ object ->{ $ setterName }( $ setterValue );
330
+ } catch ( \ LogicException $ e ) {
331
+ $ this -> processInputErrorForNestedSet ([ $ camelCaseProperty ] );
333
332
}
334
333
}
335
334
0 commit comments