mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
De-enforcing key naming conventions when converting Model results to object
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3604 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
1b976ee89b
commit
7df9917319
1 changed files with 6 additions and 1 deletions
|
@ -105,6 +105,11 @@ class Set extends Object {
|
|||
}
|
||||
|
||||
function __map($value, $class, $identity = null) {
|
||||
|
||||
if (is_object($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (!empty($value) && Set::numeric(array_keys($value))) {
|
||||
$ret = array();
|
||||
foreach ($value as $key => $val) {
|
||||
|
@ -124,7 +129,7 @@ class Set extends Object {
|
|||
$keys = array_keys($value);
|
||||
foreach ($value as $key => $val) {
|
||||
if (!is_numeric($key) && strlen($key) > 1) {
|
||||
if ($key{0} == strtoupper($key{0}) && $key{1} == strtolower($key{1})) {
|
||||
if ($key{0} == strtoupper($key{0}) && $key{1} == strtolower($key{1}) && (is_array($val) || is_object($val))) {
|
||||
if ($key == $keys[0]) {
|
||||
$ret = Set::__map($val, $class, $key);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue