PHP Class DB\SQL\Mapper

Inheritance: extends DB\Cursor
Datei anzeigen Open project: bcosca/fatfree Class Usage Examples

Protected Properties

Property Type Description
$_id
$adhoc
$db
$engine
$fields
$source
$table

Public Methods

Method 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

Protected Methods

Method Description
factory ( $row ) : object Convert array to mapper object

Method Details

__construct() public method

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 method

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

changed() public method

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

clear() public method

Clear value of field
public clear ( $key ) : null
$key string
return null

copyfrom() public method

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

copyto() public method

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

count() public method

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

dbtype() public method

Return database type
public dbtype ( ) : string
return string

erase() public method

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

exists() public method

Return TRUE if field is defined
public exists ( $key ) : boolean
$key string
return boolean

factory() protected method

Convert array to mapper object
protected factory ( $row ) : object
$row array
return object

fields() public method

Return field names
public fields ( $adhoc = TRUE ) : array
$adhoc bool
return array

find() public method

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

get() public method

Retrieve value of field
public get ( $key ) : scalar
$key string
return scalar

getiterator() public method

Retrieve external iterator for fields
public getiterator ( ) : object
return object

insert() public method

Insert new record
public insert ( ) : object
return object

required() public method

Return TRUE if field is not nullable
public required ( $field ) : boolean
$field string
return boolean

reset() public method

Reset cursor
public reset ( ) : null
return null

schema() public method

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

select() public method

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
return static[]

set() public method

Assign value to field
public set ( $key, $val ) : scalar
$key string
$val scalar
return scalar

skip() public method

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

table() public method

Return mapped table
public table ( ) : string
return string

type() public method

Get PHP type equivalent of PDO constant
public type ( $pdo ) : string
$pdo string
return string

update() public method

Update current record
public update ( ) : object
return 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