replaced ucfirst by underscoreToCamelcase for calculating method name
This commit is contained in:
@@ -402,7 +402,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
|||||||
return $noGetterData[$keyAttribute];
|
return $noGetterData[$keyAttribute];
|
||||||
}
|
}
|
||||||
|
|
||||||
$getter = sprintf("get%s", ucfirst($attribute));
|
$getter = sprintf("get%s", underscoreToCamelcase($attribute));
|
||||||
if (method_exists($data, $getter)) {
|
if (method_exists($data, $getter)) {
|
||||||
$return = $data->$getter();
|
$return = $data->$getter();
|
||||||
|
|
||||||
@@ -427,6 +427,26 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transcode an underscored string into a camel-cased string, eg. default_folder into DefaultFolder
|
||||||
|
*
|
||||||
|
* @param string $str the string to convert from underscore to camel-case
|
||||||
|
*
|
||||||
|
* @return string the camel cased string.
|
||||||
|
*/
|
||||||
|
private function underscoreToCamelcase($str) {
|
||||||
|
// Split string in words.
|
||||||
|
$words = explode('_', strtolower($str));
|
||||||
|
|
||||||
|
$return = '';
|
||||||
|
|
||||||
|
foreach ($words as $word) {
|
||||||
|
$return .= ucfirst(trim($word));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the various smarty plugins hendled by this class
|
* Define the various smarty plugins hendled by this class
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user