PHP Class DB\SQL\Mapper

Inheritance: extends DB\Cursor
Afficher le fichier Open project: bcosca/fatfree Class Usage Examples

Protected Properties

Свойство Type Description
$_id
$adhoc
$db
$engine
$fields
$source
$table

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
factory ( $row ) : object Convert array to mapper object

Method Details

__construct() public méthode

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

cast() public méthode

Return fields of mapper object as an associative array
public cast ( $obj = NULL ) : array
$obj object
Résultat array

changed() public méthode

Return TRUE if any/specified field value has changed
public changed ( $key = NULL ) : boolean
$key string
Résultat boolean

clear() public méthode

Clear value of field
public clear ( $key ) : null
$key string
Résultat null

copyfrom() public méthode

Hydrate mapper object using hive array variable
public copyfrom ( $var, $func = NULL ) : null
$var array|string
$func callback
Résultat null

copyto() public méthode

Populate hive array variable with mapper fields
public copyto ( $key ) : null
$key string
Résultat null

count() public méthode

Count records that match criteria
public count ( $filter = NULL, $ttl ) : integer
$filter string|array
$ttl int|array
Résultat integer

dbtype() public méthode

Return database type
public dbtype ( ) : string
Résultat string

erase() public méthode

Delete current record
public erase ( $filter = NULL ) : integer
$filter string|array
Résultat integer

exists() public méthode

Return TRUE if field is defined
public exists ( $key ) : boolean
$key string
Résultat boolean

factory() protected méthode

Convert array to mapper object
protected factory ( $row ) : object
$row array
Résultat object

fields() public méthode

Return field names
public fields ( $adhoc = TRUE ) : array
$adhoc bool
Résultat array

find() public méthode

Return records that match criteria
public find ( $filter = NULL, array $options = NULL, $ttl ) : static[]
$filter string|array
$options array array
$ttl int|array
Résultat static[]

get() public méthode

Retrieve value of field
public get ( $key ) : scalar
$key string
Résultat scalar

getiterator() public méthode

Retrieve external iterator for fields
public getiterator ( ) : object
Résultat object

insert() public méthode

Insert new record
public insert ( ) : object
Résultat object

required() public méthode

Return TRUE if field is not nullable
public required ( $field ) : boolean
$field string
Résultat boolean

reset() public méthode

Reset cursor
public reset ( ) : null
Résultat null

schema() public méthode

Return schema and, if the first argument is provided, update it
public schema ( $fields = null ) : array
$fields NULL|array
Résultat array

select() public méthode

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
Résultat static[]

set() public méthode

Assign value to field
public set ( $key, $val ) : scalar
$key string
$val scalar
Résultat scalar

skip() public méthode

Return record at specified offset using same criteria as previous load() call and make it active
public skip ( $ofs = 1 ) : array
$ofs int
Résultat array

table() public méthode

Return mapped table
public table ( ) : string
Résultat string

type() public méthode

Get PHP type equivalent of PDO constant
public type ( $pdo ) : string
$pdo string
Résultat string

update() public méthode

Update current record
public update ( ) : object
Résultat object

Property Details

$_id protected_oe property

protected $_id

$adhoc protected_oe property

protected $adhoc

$db protected_oe property

protected $db

$engine protected_oe property

protected $engine

$fields protected_oe property

protected $fields

$source protected_oe property

protected $source

$table protected_oe property

protected $table