public static function newOne($type, $data = array()) { $settings = Arrays::exists($type, static::$_settings) ? static::$_settings[$type] : static::defaultConfig($type); $fields = Arrays::exists($type, static::$_fields) ? static::$_fields[$type] : static::noConfigFields($type); $obj = new objData(); $obj->thin_type = $type; if (count($fields) && count($data) && Arrays::isAssoc($data)) { foreach ($fields as $key => $infos) { $value = Arrays::exists($key, $data) ? $data[$key] : null; $obj->{$key} = Arrays::is($value) && Arrays::isAssoc($value) ? Arrays::setObject($value) : $value; } } return $obj; }