PHP Класс OCA\Richdocuments\Db

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$data
$insertStatement
$loadStatement
$tableName

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

Метод Описание
__call ( $name, $arguments )
__construct ( $data = [] )
deleteBy ( string $field, mixed $value ) Delete records matching the condition
getCollection ( ) : array Get all records from the table
getCollectionBy ( string $field, mixed $value ) : array Get array of matching records
getData ( ) : Array Get object data
getLastInsertId ( ) : mixed Get id of the recently inserted record
hasData ( ) : boolean Check if there are any data in current object
insert ( ) : mixed Insert current object data into database
load ( integer $value ) : Db Get single record by primary key
loadBy ( string $field, mixed $value ) : Db Get single record matching condition
setData ( array $data ) Set object data

Защищенные методы

Метод Описание
buildInQuery ( string $field, Array $array ) : String Build placeholders for the query with variable input data
execute ( string $statement, mixed $args = null ) : mixed Execute a query on database

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

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

public __call ( $name, $arguments )

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

public __construct ( $data = [] )

buildInQuery() защищенный Метод

Build placeholders for the query with variable input data
protected buildInQuery ( string $field, Array $array ) : String
$field string field name
$array Array data
Результат String `field` IN (?, ?...) placeholders matching the number of elements in array

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

Delete records matching the condition
public deleteBy ( string $field, mixed $value )
$field string for WHERE condition
$value mixed matching value(s)

execute() защищенный Метод

Execute a query on database
protected execute ( string $statement, mixed $args = null ) : mixed
$statement string query to be executed
$args mixed value(s) for the query. If omited the query will be run on the current object $data
Результат mixed (array/false)

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

Get all records from the table
public getCollection ( ) : array
Результат array

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

Get array of matching records
public getCollectionBy ( string $field, mixed $value ) : array
$field string for WHERE condition
$value mixed matching value(s)
Результат array

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

Get object data
public getData ( ) : Array
Результат Array

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

Get id of the recently inserted record
public getLastInsertId ( ) : mixed
Результат mixed

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

Check if there are any data in current object
public hasData ( ) : boolean
Результат boolean

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

Insert current object data into database
public insert ( ) : mixed
Результат mixed

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

Get single record by primary key
public load ( integer $value ) : Db
$value integer primary key value
Результат Db

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

Get single record matching condition
public loadBy ( string $field, mixed $value ) : Db
$field string for WHERE condition
$value mixed matching value(s)
Результат Db

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

Set object data
public setData ( array $data )
$data array

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

$data защищенное свойство

protected $data

$insertStatement защищенное свойство

protected $insertStatement

$loadStatement защищенное свойство

protected $loadStatement

$tableName защищенное свойство

protected $tableName