PHP Class SDb

Inheritance: extends Db
Exibir arquivo Open project: hetao29/slightphp Class Usage Examples

Public Methods

Method Description
__construct ( string $table_name = "", $config = [] ) : void 构造方法
__get ( $k )
__set ( $k, $v )
del ( $foreign_info = false ) 删除信息,可以连带外键一起删除
get ( $foreign_info = false ) 得到信息,返回数组,可以用对像获取本身
getAll ( ) 得到带外键的信息
getConfig ( string $zone = null, string $type = "main" ) : array
listAll ( $condition, $foreign_info = false ) * 按条件获取所有信息
reset ( ) 重设所有参数
set ( ) 保存信息,支持外键属性保存 当外键属性保存时,特别注意: 你必须初始化外键的值,否则可能无效,如: $test->user_profile = new stdclass; $test->user_profile->field_name = "field_value";
setConfig ( string $zone, string $type = "main" ) : array 设置数据库配置文件
setConfigFile ( string $file ) : void set global db config file
setForeignKey ( $keys = [] ) 设置外键关联
setTable ( $table_name )
useConfig ( $zone, $type = "main" )

Method Details

__construct() public method

构造方法
public __construct ( string $table_name = "", $config = [] ) : void
$table_name string
return void

__get() public method

public __get ( $k )

__set() public method

public __set ( $k, $v )

del() public method

删除信息,可以连带外键一起删除
public del ( $foreign_info = false )

get() public method

得到信息,返回数组,可以用对像获取本身
public get ( $foreign_info = false )

getAll() public method

得到带外键的信息
public getAll ( )

getConfig() static public method

static public getConfig ( string $zone = null, string $type = "main" ) : array
$zone string
$type string main|query
return array

listAll() public method

* 按条件获取所有信息
public listAll ( $condition, $foreign_info = false )
$condition 条件,参照Db::select()里的定义
$foreign_info 是否返回外键信息

reset() public method

重设所有参数
public reset ( )

set() public method

保存信息,支持外键属性保存 当外键属性保存时,特别注意: 你必须初始化外键的值,否则可能无效,如: $test->user_profile = new stdclass; $test->user_profile->field_name = "field_value";
public set ( )

setConfig() public method

设置数据库配置文件
public setConfig ( string $zone, string $type = "main" ) : array
$zone string
$type string main|query
return array

setConfigFile() static public method

set global db config file
static public setConfigFile ( string $file ) : void
$file string
return void

setForeignKey() public method

设置外键关联
public setForeignKey ( $keys = [] )

setTable() public method

public setTable ( $table_name )

useConfig() public method

Deprecation: use setConfig
public useConfig ( $zone, $type = "main" )