Property | Type | Description | |
---|---|---|---|
$crud_results | boolean | Used for check the CRUD action results | |
$primary_key | string | Name of field as primary key | |
$sql_filename | string | The filename of SQL file with the database table structure and init data. | |
$table_name | string | The name of the database table with the WordPress prefix |
Method | Description | |
---|---|---|
__construct ( string $table_name, string $sql_file = '', string $primary_key = 'id' ) : WPDKDBTableModel | Create an instance of WPDKDBTableModel class | |
delete ( integer | array $id ) : integer | boolean | Delete one or more record from table. Return the number of rows affected/selected or WP_Error. | |
group_by ( string $column, string $order = 'ASC' ) : mixed | Return a list of groupped by column. Use 'value' as selector | |
insert ( ) : integer | WP_Error | Insert a record by values and return the id on successfull, otherwise return WP_Error. | |
map ( object $source_row, object $destination_object ) : object | boolean | Map the properties fields of single database row into a destination object model. | |
primaryKey ( ) : string | Return the name of the primary key | |
select ( ) | Select data | |
update ( ) : integer | WP_Error | Update a record by values and retrun TRUE onsuccessfully, otherwise return a WP_Error. | |
update_table ( ) : boolean | Do an update the table via WordPress dbDelta() function. Apply a new SQL file on the exists (or do not exists) table. Return TRUE on success | |
where ( array $args, string $key, string $table_prefix = '', array $not_in = [], string $cond = '=' ) : string | Return a where condiction with possible OR values | |
where_date ( array $args, string $column_key, string $table_prefix = '', string $accuracy = '%Y-%m-%d %H:%i:%s' ) : string | Return a where condiction for date and date time | |
where_filter ( array $args, string $filter, string $key, string $table_prefix = '', array $not_in = [], string $cond = '=' ) : string | Return a where condiction with possible OR values for a filter. Useful for JOIN table |
public __construct ( string $table_name, string $sql_file = '', string $primary_key = 'id' ) : WPDKDBTableModel | ||
$table_name | string | The name of the database table without WordPress prefix |
$sql_file | string | Optional. The filename of SQL file with the database table structure and init data. |
$primary_key | string | Optional. If FALSE the primary key is get from database. |
return | WPDKDBTableModel |
public primaryKey ( ) : string | ||
return | string |
public update_table ( ) : boolean | ||
return | boolean |
public static where ( array $args, string $key, string $table_prefix = '', array $not_in = [], string $cond = '=' ) : string | ||
$args | array | Arguments list |
$key | string | A key selector |
$table_prefix | string | Optional. Table prefix |
$not_in | array | Optional. Value to exclude |
$cond | string | Optional. Condiction used, default '=' or 'LIKE' |
return | string |
public static where_date ( array $args, string $column_key, string $table_prefix = '', string $accuracy = '%Y-%m-%d %H:%i:%s' ) : string | ||
$args | array | Arguments list |
$column_key | string | Name of column |
$table_prefix | string | Optional. Table prefix |
$accuracy | string | Optional. Default = '%Y-%m-%d %H:%i:%s' |
return | string |
public static where_filter ( array $args, string $filter, string $key, string $table_prefix = '', array $not_in = [], string $cond = '=' ) : string | ||
$args | array | Arguments list |
$filter | string | A key for filter |
$key | string | A key selector |
$table_prefix | string | Optional. Table prefix |
$not_in | array | Optional. Value to exclude |
$cond | string | Optional. Condiction used, default '=' or 'LIKE' |
return | string |
public bool $crud_results | ||
return | boolean |
public string $primary_key | ||
return | string |
public string $sql_filename | ||
return | string |
public string $table_name | ||
return | string |