PHP Class BaseTable, DumbledORM

Mostrar archivo Open project: jasonmoo/DumbledORM Class Usage Examples

Protected Properties

Property Type Description
$changed
$data
$id
$meta
$meta_class
$meta_field
$pk
$relation_data
$relations
$table

Public Methods

Method Description
__call ( string $method, Array $params = [] ) : mixed most of the magic in here makes it all work - handles all getters and setters on columns and relations
__construct ( mixed $val = null ) construct object and load supplied data or fetch data by supplied id
addMeta ( array $data ) add an array of key/val to the metadata
create ( BaseTable $obj ) : BaseTable create an object with a defined relation to this one.
delete ( ) : void delete this object's record from self::$table and any associated meta data
find ( array $constraints ) : ResultSet search for any number of records in self::$table
getId ( ) : integer simple output object pk id
getMeta ( string $field ) : mixed get a field of metadata
hydrate ( array $data ) store supplied data and bring object state to current
one ( array $constraints ) : BaseTable search for single record in self::$table
save ( ) : void insert or update modified object data into self::$table and any associated metadata
select ( string $qs, mixed $params = null ) : ResultSet execute a query in self::$table
setMeta ( string $field, string $val ) set a field of metadata
toArray ( ) : Array simple output object data as array

Private Methods

Method Description
_loadMeta ( ) : void internally fetch and load any associated metadata

Method Details

__call() final public method

most of the magic in here makes it all work - handles all getters and setters on columns and relations
final public __call ( string $method, Array $params = [] ) : mixed
$method string
$params Array
return mixed

__construct() public method

construct object and load supplied data or fetch data by supplied id
public __construct ( mixed $val = null )
$val mixed

addMeta() public method

add an array of key/val to the metadata
public addMeta ( array $data )
$data array

create() final public method

create an object with a defined relation to this one.
final public create ( BaseTable $obj ) : BaseTable
$obj BaseTable
return BaseTable

delete() public method

delete this object's record from self::$table and any associated meta data
public delete ( ) : void
return void

find() final public static method

search for any number of records in self::$table
final public static find ( array $constraints ) : ResultSet
$constraints array
return ResultSet

getId() final public method

simple output object pk id
final public getId ( ) : integer
return integer

getMeta() public method

get a field of metadata
public getMeta ( string $field ) : mixed
$field string
return mixed

hydrate() final public method

store supplied data and bring object state to current
final public hydrate ( array $data )
$data array

one() final public static method

search for single record in self::$table
final public static one ( array $constraints ) : BaseTable
$constraints array
return BaseTable

save() public method

insert or update modified object data into self::$table and any associated metadata
public save ( ) : void
return void

select() final public static method

execute a query in self::$table
final public static select ( string $qs, mixed $params = null ) : ResultSet
$qs string
$params mixed
return ResultSet

setMeta() public method

set a field of metadata
public setMeta ( string $field, string $val )
$field string
$val string

toArray() final public method

simple output object data as array
final public toArray ( ) : Array
return Array

Property Details

$changed protected_oe property

protected $changed

$data protected_oe property

protected $data

$id protected_oe property

protected $id

$meta protected_oe property

protected $meta

$meta_class protected_oe static_oe property

protected static $meta_class

$meta_field protected_oe static_oe property

protected static $meta_field

$pk protected_oe static_oe property

protected static $pk

$relation_data protected_oe property

protected $relation_data

$relations protected_oe static_oe property

protected static $relations

$table protected_oe static_oe property

protected static $table