* code for task #43347.

This commit is contained in:
王怡栋
2021-10-26 15:39:46 +08:00
parent 7fb8c5ca8b
commit 001ca0ef8f
5 changed files with 41 additions and 2 deletions
+24
View File
@@ -486,6 +486,8 @@ class baseEntry
$type = $field[1];
$isArray = false;
if(!isset($object->$key)) continue;
$pos = strpos($type, ']');
if($pos !== FALSE)
{
@@ -519,6 +521,28 @@ class baseEntry
}
}
/**
* Filter fields.
*
* @param object $object
* @param array $filters
* @access public
* @return object
*/
public function filterFields($object, $allowable = '')
{
if(empty($allowable)) return $object;
$filtered = new stdclass();
foreach($allowable as $field)
{
if(!isset($object->$field)) continue;
$filtered->$field = $object->$field;
}
return $filtered;
}
/**
* 类型转换.
* Typecasting.