PHP Класс DB\SQL\Mapper

Наследование: extends DB\Cursor
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_id
$adhoc
$db
$engine
$fields
$source
$table

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

Метод Описание
__construct ( SQL $db, $table, $fields = NULL, $ttl = 60 ) Instantiate class
cast ( $obj = NULL ) : array Return fields of mapper object as an associative array
changed ( $key = NULL ) : boolean Return TRUE if any/specified field value has changed
clear ( $key ) : null Clear value of field
copyfrom ( $var, $func = NULL ) : null Hydrate mapper object using hive array variable
copyto ( $key ) : null Populate hive array variable with mapper fields
count ( $filter = NULL, $ttl ) : integer Count records that match criteria
dbtype ( ) : string Return database type
erase ( $filter = NULL ) : integer Delete current record
exists ( $key ) : boolean Return TRUE if field is defined
fields ( $adhoc = TRUE ) : array Return field names
find ( $filter = NULL, array $options = NULL, $ttl ) : static[] Return records that match criteria
get ( $key ) : scalar Retrieve value of field
getiterator ( ) : object Retrieve external iterator for fields
insert ( ) : object Insert new record
required ( $field ) : boolean Return TRUE if field is not nullable
reset ( ) : null Reset cursor
schema ( $fields = null ) : array Return schema and, if the first argument is provided, update it
select ( $fields, $filter = NULL, array $options = NULL, $ttl ) : static[] Build query string and execute
set ( $key, $val ) : scalar Assign value to field
skip ( $ofs = 1 ) : array Return record at specified offset using same criteria as previous load() call and make it active
table ( ) : string Return mapped table
type ( $pdo ) : string Get PHP type equivalent of PDO constant
update ( ) : object Update current record

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

Метод Описание
factory ( $row ) : object Convert array to mapper object

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

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

Instantiate class
public __construct ( SQL $db, $table, $fields = NULL, $ttl = 60 )
$db DB\SQL object
$table string
$fields array|string
$ttl int|array

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

Return fields of mapper object as an associative array
public cast ( $obj = NULL ) : array
$obj object
Результат array

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

Return TRUE if any/specified field value has changed
public changed ( $key = NULL ) : boolean
$key string
Результат boolean

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

Clear value of field
public clear ( $key ) : null
$key string
Результат null

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

Hydrate mapper object using hive array variable
public copyfrom ( $var, $func = NULL ) : null
$var array|string
$func callback
Результат null

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

Populate hive array variable with mapper fields
public copyto ( $key ) : null
$key string
Результат null

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

Count records that match criteria
public count ( $filter = NULL, $ttl ) : integer
$filter string|array
$ttl int|array
Результат integer

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

Return database type
public dbtype ( ) : string
Результат string

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

Delete current record
public erase ( $filter = NULL ) : integer
$filter string|array
Результат integer

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

Return TRUE if field is defined
public exists ( $key ) : boolean
$key string
Результат boolean

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

Convert array to mapper object
protected factory ( $row ) : object
$row array
Результат object

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

Return field names
public fields ( $adhoc = TRUE ) : array
$adhoc bool
Результат array

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

Return records that match criteria
public find ( $filter = NULL, array $options = NULL, $ttl ) : static[]
$filter string|array
$options array array
$ttl int|array
Результат static[]

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

Retrieve value of field
public get ( $key ) : scalar
$key string
Результат scalar

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

Retrieve external iterator for fields
public getiterator ( ) : object
Результат object

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

Insert new record
public insert ( ) : object
Результат object

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

Return TRUE if field is not nullable
public required ( $field ) : boolean
$field string
Результат boolean

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

Reset cursor
public reset ( ) : null
Результат null

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

Return schema and, if the first argument is provided, update it
public schema ( $fields = null ) : array
$fields NULL|array
Результат array

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

Build query string and execute
public select ( $fields, $filter = NULL, array $options = NULL, $ttl ) : static[]
$fields string
$filter string|array
$options array array
$ttl int|array
Результат static[]

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

Assign value to field
public set ( $key, $val ) : scalar
$key string
$val scalar
Результат scalar

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

Return record at specified offset using same criteria as previous load() call and make it active
public skip ( $ofs = 1 ) : array
$ofs int
Результат array

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

Return mapped table
public table ( ) : string
Результат string

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

Get PHP type equivalent of PDO constant
public type ( $pdo ) : string
$pdo string
Результат string

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

Update current record
public update ( ) : object
Результат object

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

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

protected $_id

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

protected $adhoc

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

protected $db

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

protected $engine

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

protected $fields

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

protected $source

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

protected $table