diff options
Diffstat (limited to 'framework/Util')
-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;
}
}
|