PHP Class RTDBModel, rtMedia

显示文件 Open project: rtCamp/rtMedia Class Usage Examples

Public Properties

Property Type Description
$mu_single_table
$per_page
$table_name type - database table linked to the model. All the queries will be fired on that table or with the join in this table. $per_page - number of rows per page to be displayed

Public Methods

Method Description
__call ( string $name, array $arguments ) : array Magic Method for getting DB rows by particular column.
__construct ( string $table_name, boolean $withprefix = false, $per_page = 10, $mu_single_table = false )
delete ( array $where ) : array
get ( array $columns, $offset = false, $per_page = false, $order_by = 'id desc' ) : array Get all the rows according to the columns set in $columns parameter.
insert ( array $row ) : integer
set_per_page ( integer $per_page ) set number of rows per page for pagination
set_table_name ( string $table_name, mixed $withprefix = false )
update ( array $data, array $where )

Method Details

__call() public method

E.g., get_by_(params)
public __call ( string $name, array $arguments ) : array
$name string - Added get_by_(value,pagging=true,page_no=1)
$arguments array
return array result array

__construct() public method

public __construct ( string $table_name, boolean $withprefix = false, $per_page = 10, $mu_single_table = false )
$table_name string Table name for model
$withprefix boolean Set true if $tablename is with prefix otherwise it will prepend wordpress prefix with "rt_"

delete() public method

public delete ( array $where ) : array
$where array
return array

get() public method

offset and rows per page can also be passed for pagination.
public get ( array $columns, $offset = false, $per_page = false, $order_by = 'id desc' ) : array
$columns array
return array

insert() public method

public insert ( array $row ) : integer
$row array
return integer

set_per_page() public method

set number of rows per page for pagination
public set_per_page ( integer $per_page )
$per_page integer

set_table_name() public method

public set_table_name ( string $table_name, mixed $withprefix = false )
$table_name string
$withprefix mixed

update() public method

public update ( array $data, array $where )
$data array
$where array

Property Details

$mu_single_table public_oe property

public $mu_single_table

$per_page public_oe property

public $per_page

$table_name public_oe property

- database table linked to the model. All the queries will be fired on that table or with the join in this table. $per_page - number of rows per page to be displayed
public type $table_name
return type