Orion PHP  0.11.12
The PHP5.3 framework
Orion\Core\Model Class Reference
+ Inheritance diagram for Orion\Core\Model:

List of all members.

Public Member Functions

 delete ()
 fillout ($args)
lock ($args=null)
 save ()
 unique ($fields)
 update ($fields=null)

Static Public Member Functions

static & fetchArrayData (&$array, &$object=null, $mergeEmpty=false)
static & fetchPostData (&$object=null, $mergeEmpty=false)
static & fetchRestData (&$object=null, $mergeEmpty=false)
static get ($args=null)
static getClass ()
static getField ($name)
static getFields ()
static getFieldsKeys ()
static getLinkedTable ($field)
static getTable ()
static hasField ($fieldname)
static isLinked ($field)
static isPrimary ($field)
static query ()

Static Protected Member Functions

static describe ()
static has ($field)
static hasEvent ($type)
static prepare ()

Protected Attributes

 $_lockedFields = array()

Static Protected Attributes

static $table
static $fields = array( )
static $primaryKeys = array( )
static $events = array( )

Detailed Description

Orion abstract model class.

Author:
Thibaut Despoulain BSD 4-clauses
Version:
0.11.12

Definition at line 17 of file model.php.


Member Function Documentation

Orion\Core\Model::delete ( )

Delete current object from database. Object must have its primary keys defined.

Returns:

Definition at line 321 of file model.php.

static Orion\Core\Model::describe ( ) [static, protected]

Override this function to bind model's attributes to corresponding 's. Usage of self::has() inside this function is advised. Be sure to first declare the required $table, $fields, $primaryKeys and $events static properties.

Definition at line 63 of file model.php.

static& Orion\Core\Model::fetchArrayData ( &$  array,
&$  object = null,
mergeEmpty = false 
) [static, final]

Return a new model object instance based on an array of keys/values

Parameters:
array$arrayThe associative array to retrieve data from
\Orion\Core\Model$object If given, data will be appended to $object
boolean$mergeEmptyMerge fields even if empty post data ?
Returns:

Definition at line 146 of file model.php.

static& Orion\Core\Model::fetchPostData ( &$  object = null,
mergeEmpty = false 
) [static, final]

Return a new model object instance filled using POST vars

Parameters:
\Orion\Core\Model$object If given, data will be appended to $object
boolean$mergeEmptyMerge fields even if empty post data ?
Returns:

Definition at line 175 of file model.php.

static& Orion\Core\Model::fetchRestData ( &$  object = null,
mergeEmpty = false 
) [static, final]

Return a new model object instance filled using PUT vars from php input stream (php://input).

Parameters:
\Orion\Core\Model$object If given, data will be appended to $object
boolean$mergeEmptyMerge fields even if empty post data ?
Returns:

Definition at line 187 of file model.php.

Orion\Core\Model::fillout ( args)

Given that primary keys are provided in object, fills out remaining attributes using an automatic select Query.

Parameters:
String...$args Fields to fill out (variable-length argument list)
Returns:

Definition at line 351 of file model.php.

static Orion\Core\Model::get ( args = null) [static, final]

Shortcut function. Similar to self::query()->select( $args ).

Parameters:
String...$args Fields to select (variable-length argument list)
Returns:

Definition at line 201 of file model.php.

static Orion\Core\Model::getClass ( ) [static, final]

Get child class name (extended model)

Returns:
string

Definition at line 211 of file model.php.

static Orion\Core\Model::getField ( name) [static, final]

Get a field of the model by its name.

Parameters:
String$nameThe name (binding identifier) of the field
Returns:

Definition at line 221 of file model.php.

static Orion\Core\Model::getFields ( ) [static, final]

Get all of the model fields as an array of fields

Returns:
[]

Definition at line 232 of file model.php.

static Orion\Core\Model::getFieldsKeys ( ) [static]

Get an array of bound fields' names/keys

Returns:
String[]

Definition at line 243 of file model.php.

static Orion\Core\Model::getLinkedTable ( field) [static, final]

Get provided field's linked table if it exists

Parameters:
string$fieldThe field identifier/name
Returns:
string The linked table

Definition at line 255 of file model.php.

static Orion\Core\Model::getTable ( ) [static, final]

Get bound table name.

Returns:
String

Definition at line 268 of file model.php.

static Orion\Core\Model::has ( field) [static, final, protected]

Define and bind a new field to current model.

Parameters:
\Orion\Model\Field$field The field definition to bind

Definition at line 76 of file model.php.

static Orion\Core\Model::hasEvent ( type) [static, final, protected]

Check if model's fields require event handling for given event.

Parameters:
string$typethe type of event to check
Returns:
Boolean

Definition at line 99 of file model.php.

static Orion\Core\Model::hasField ( fieldname) [static, final]

Check wether provided field is bound to model.

Parameters:
string$fieldname
Returns:
boolean

Definition at line 278 of file model.php.

static Orion\Core\Model::isLinked ( field) [static, final]

Check wether a field is linked to another model

Parameters:
String$field
Returns:
boolean

Definition at line 288 of file model.php.

static Orion\Core\Model::isPrimary ( field) [static, final]

Check wether provided field is primary or not.

Parameters:
string$field
Returns:
boolean

Definition at line 298 of file model.php.

& Orion\Core\Model::lock ( args = null)

Lock given fields for update query. (Make them uneditable)

Parameters:
Mixed$argsArray or VL list of fields to deny update possibility.

Definition at line 371 of file model.php.

static Orion\Core\Model::prepare ( ) [static, final, protected]

Prepare model for Query::Factory().

Call describe() if fields attribute is not set. Check table binding.

Returns:
String The model class name to be used by the Query::Factory

Definition at line 119 of file model.php.

static Orion\Core\Model::query ( ) [static, final]

(Factory) Create and return a new Query instance.

Returns:

Definition at line 307 of file model.php.

Orion\Core\Model::save ( )

Save current object into database. Object must have its primary keys defined.

Returns:

Definition at line 390 of file model.php.

Orion\Core\Model::unique ( fields)

Check the uniqueness of the object for provided fields

Parameters:
Mixed$fieldsCan either be a single field name, an array of field names, or even a variable-length argument list of field names. Leave blank for a check on all primary fields.
stringField name
Returns:
Boolean

Definition at line 425 of file model.php.

Orion\Core\Model::update ( fields = null)

Update current object into database. Object must have its primary keys defined.

Returns:

Definition at line 457 of file model.php.


Member Data Documentation

Orion::Core\Model::$_lockedFields = array() [protected]

Definition at line 27 of file model.php.

Orion::Core\Model::$events = array( ) [static, protected]

Definition at line 55 of file model.php.

Orion::Core\Model::$fields = array( ) [static, protected]

Definition at line 43 of file model.php.

Orion::Core\Model::$primaryKeys = array( ) [static, protected]

Definition at line 49 of file model.php.

Orion::Core\Model::$table [static, protected]

Definition at line 37 of file model.php.


The documentation for this class was generated from the following file: