diff options
author | ctrlaltca@gmail.com <> | 2011-10-26 09:57:31 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-10-26 09:57:31 +0000 |
commit | 23757f1c010f0d6123e52c89a3c29caa1a6373ef (patch) | |
tree | c6cd16d48b8a7d9714ab1c0c95c538a115f64617 /framework/Util/TDataFieldAccessor.php | |
parent | 615c15d9a2001c58b2030c23b44f655b57dd21d0 (diff) |
proposed patch for #325
Diffstat (limited to 'framework/Util/TDataFieldAccessor.php')
-rw-r--r-- | framework/Util/TDataFieldAccessor.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/framework/Util/TDataFieldAccessor.php b/framework/Util/TDataFieldAccessor.php index ac747556..1b494b18 100644 --- a/framework/Util/TDataFieldAccessor.php +++ b/framework/Util/TDataFieldAccessor.php @@ -4,7 +4,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2011 PradoSoft + * @copyright Copyright © 2005-2011 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Util
@@ -58,16 +58,16 @@ class TDataFieldAccessor {
if(strpos($field,'.')===false) // simple field
{
- if(property_exists($data,$field))
- return $data->{$field};
- else
+ if(method_exists($data, 'get'.$field))
return call_user_func(array($data,'get'.$field));
+ else
+ return $data->{$field};
}
else // field in the format of xxx.yyy.zzz
{
$object=$data;
foreach(explode('.',$field) as $f)
- $object = TDataFieldAccessor::getDataFieldValue($object, $f); + $object = TDataFieldAccessor::getDataFieldValue($object, $f);
return $object;
}
}
|