PHP Класс Microweber\Providers\DatabaseManager

Наследование: extends Microweber\Providers\Database\Utils, use trait Microweber\Traits\QueryFilter, use trait Microweber\Traits\ExtendedSave
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$app Microweber\Application
$use_cache

Открытые методы

Метод Описание
__construct ( $app = null ) trait to save extended data, such as attributes, categories and images
delete_by_id ( string $table, integer | string $id, string $field_name = 'id' ) : boolean Deletes item by id from db table.
get ( $table, string | array $params = null ) : mixed Get items from the database.
get_by_id ( string $table, integer | string $id, string $field_name = 'id' ) : array | boolean | mixed Get table row by id.
last_id ( $table ) : boolean | integer Get last id from a table.
q ( $q, $silent = false )
query ( string $q, string | boolean $cache_id = false, string | boolean $cache_group = 'global', boolean $only_query = false, array | boolean $connection_settings = false ) : array | boolean | mixed Executes plain query in the database.
save ( $table, $data = false, boolean $data_to_save_options = false ) : string | integer Generic save data function, it saves data to the database.
table ( $table )

Описание методов

__construct() публичный Метод

trait to save extended data, such as attributes, categories and images
public __construct ( $app = null )

delete_by_id() публичный Метод

Deletes item by id from db table.
public delete_by_id ( string $table, integer | string $id, string $field_name = 'id' ) : boolean
$table string Your da table name
$id integer | string The id to delete
$field_name string You can set custom column to delete by it, default is id
Результат boolean

get() публичный Метод

You can use this handy function to get whatever you need from any db table.
public get ( $table, string | array $params = null ) : mixed
$params string | array parameters for the DB
Результат mixed Array with data or false or integer if page_count is set

get_by_id() публичный Метод

It returns full db row from a db table
public get_by_id ( string $table, integer | string $id, string $field_name = 'id' ) : array | boolean | mixed
$table string Your table
$id integer | string The id to get
$field_name string You can set custom column to get by it, default is id
Результат array | boolean | mixed

last_id() публичный Метод

Get last id from a table.
public last_id ( $table ) : boolean | integer
$table
Результат boolean | integer

q() публичный Метод

public q ( $q, $silent = false )

query() публичный Метод

You can use this function to make queries in the db by writing your own sql The results are returned as array or false if nothing is found
public query ( string $q, string | boolean $cache_id = false, string | boolean $cache_group = 'global', boolean $only_query = false, array | boolean $connection_settings = false ) : array | boolean | mixed
$q string Your SQL query
$cache_id string | boolean It will save the query result in the cache. Set to false to disable
$cache_group string | boolean Stores the result in certain cache group. Set to false to disable
$only_query boolean If set to true, will perform only a query without returning a result
$connection_settings array | boolean
Результат array | boolean | mixed

save() публичный Метод

Generic save data function, it saves data to the database.
public save ( $table, $data = false, boolean $data_to_save_options = false ) : string | integer
$table
$data
$data_to_save_options boolean
Результат string | integer The id of the saved row.

table() публичный Метод

public table ( $table )

Описание свойств

$app публичное свойство

public Application,Microweber $app
Результат Microweber\Application

$use_cache публичное свойство

public $use_cache