From 2d858671700fd866d40f682d2e3ba33ad40d0c37 Mon Sep 17 00:00:00 2001 From: Mateus Revoredo Date: Sun, 29 Mar 2015 16:10:16 -0300 Subject: [PATCH 1/2] Changing atomatic setter method name guessing to fully convert to camel case --- src/JsonMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JsonMapper.php b/src/JsonMapper.php index 6e5ebac09..a3581b44c 100644 --- a/src/JsonMapper.php +++ b/src/JsonMapper.php @@ -307,7 +307,7 @@ protected function inspectProperty(ReflectionClass $rc, $name) } // Parameter could not be directly set, so lets go for setter methods - $setter = 'set' . ucfirst($name); + $setter = 'set' . preg_replace('/(?:^|_)(.?)/e',"strtoupper('$1')",$name); if (!$rc->hasMethod($setter)) { if ($rc->hasProperty($name)) { From 4c36a8125f7c27e6fdbf27d72f5f5dd5b6f76bf3 Mon Sep 17 00:00:00 2001 From: Mateus Revoredo Date: Mon, 30 Mar 2015 08:30:05 -0300 Subject: [PATCH 2/2] Changing atomatic setter method name guessing to fully convert to camel case --- src/JsonMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JsonMapper.php b/src/JsonMapper.php index a3581b44c..5102d9c1a 100644 --- a/src/JsonMapper.php +++ b/src/JsonMapper.php @@ -307,7 +307,7 @@ protected function inspectProperty(ReflectionClass $rc, $name) } // Parameter could not be directly set, so lets go for setter methods - $setter = 'set' . preg_replace('/(?:^|_)(.?)/e',"strtoupper('$1')",$name); + $setter = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $name))); if (!$rc->hasMethod($setter)) { if ($rc->hasProperty($name)) {