메소드 |
설명 |
|
__clone ( ) |
Clone DSQL |
|
__construct ( $options = [] ) |
Initialization of ID field, which must always be defined |
|
_dsql ( ) : DB_dsql |
Use this instead of accessing dsql directly. |
|
_preexec ( ) |
|
|
_ref ( $ref, $class, $field, $val ) |
|
|
_refBind ( $field_in, $expression, $field_out = null ) |
Strange method. Uses undefined $field variable, undefined refBind() method etc. |
|
addCache ( $controller, $table = null, $priority = 5 ) |
|
|
addCondition ( mixed $field, mixed $cond = UNDEFINED, mixed $value = UNDEFINED, DB_dsql $dsql = null ) |
Adds "WHERE" condition / conditions in underlying DSQL. |
|
addExpression ( string $name, mixed $expression = null ) : DB_dsql |
Adds and returns SQL-calculated expression as a read-only field. |
|
addField ( string $name, string $actual_field = null ) : Field |
Adds field to model |
|
containsMany ( $field, $model ) |
Defines multiple contained models for field |
|
containsOne ( $field, $model ) |
Defines contained model for field |
|
count ( string $alias = null ) : DB_dsql |
Returns dynamic query selecting number of entries in the database. |
|
current ( ) |
|
|
debug ( boolean $enabled = true ) |
Turns debugging mode on|off for this model. All database operations will be outputed. |
|
delete ( $id = null ) |
Deletes record matching the ID |
|
deleteAll ( ) |
Deletes all records matching this model. Use with caution. |
|
dsql ( ) : DB_dsql |
Produces a clone of Dynamic SQL object configured with table, conditions and joins of this model. |
|
each ( $callable ) |
|
|
exception ( ) |
exception() will automatically add information about current model and will allow to turn on "debug" mode |
|
fieldQuery ( $field ) |
Return query for a specific field. All other fields are ommitted. |
|
get ( $name = null ) |
|
|
getActualFields ( $group = UNDEFINED ) |
|
|
getBy ( $field, $cond = UNDEFINED, $value = UNDEFINED ) |
Loads data record and return array of that data. Will not affect currently loaded record. |
|
getField ( $f ) |
|
|
getRef ( $name, $load = null ) |
|
|
getRows ( $fields = null ) |
Loads all matching data into array of hashes |
|
hasField ( $name ) |
|
|
hasMany ( $model, $their_field = null, $our_field = null, $as_field = null ) |
Defines many to one association |
|
hasOne ( $model, $our_field = null, $display_field = null, $as_field = null ) |
Defines one to many association |
|
init ( ) |
|
|
initQuery ( ) |
Initializes base query for this model. |
|
isDirty ( $name ) |
|
|
isInstanceLoaded ( ) |
|
|
join ( $foreign_table, $master_field = null, $join_kind = null, $_foreign_alias = null, $relation = null ) |
Constructs model from multiple tables. |
|
key ( ) |
|
|
leftJoin ( $foreign_table, $master_field = null, $join_kind = null, $_foreign_alias = null, $relation = null ) |
Creates weak join between tables. |
|
load ( $id ) |
Loads record specified by ID. |
|
loadAny ( ) |
Loads the first matching record from the model |
|
loadBy ( $field, $cond = UNDEFINED, $value = UNDEFINED ) |
Similar to loadAny() but will apply condition before loading. |
|
loadData ( $id = null ) |
|
|
loadRandom ( ) |
|
|
newField ( $name ) |
|
|
next ( ) |
|
|
offsetExists ( $name ) |
|
|
offsetGet ( $name ) |
|
|
offsetSet ( $name, $val ) |
|
|
offsetUnset ( $name ) |
|
|
ref ( $name, $load = null ) |
Traverses references. Use field name for hasOne() relations. Use model name for hasMany() |
|
refSQL ( $name, $load = null ) |
Returns Model with SQL join usable for subqueries. |
|
reset ( ) |
|
|
rewind ( ) |
{{{ Iterator support |
|
save ( ) |
Save model into database and load it back. |
|
saveAndUnload ( ) |
Save model into database and don't try to load it back |
|
saveAs ( $model ) |
Save model into database and try to load it back as a new model of specified class. |
|
selectQuery ( array $fields = null ) : DB_dsql |
Completes initialization of dsql() by adding fields and expressions. |
|
serialize ( ) |
|
|
set ( $name, $value = UNDEFINED ) |
Override all methods to keep back-compatible |
|
setActualFields ( array $fields ) |
|
|
setDirty ( $name ) |
|
|
setLimit ( $count, $offset = null ) |
Sets limit on query |
|
setMasterField ( $field, $value ) |
|
|
setOrder ( $field, $desc = null ) |
Sets an order on the field. Field must be properly defined |
|
setSource ( $controller, $table = null, $id = null ) |
|
|
sum ( string | array | Field $field ) : DB_dsql |
Returns dynamic query selecting sum of particular field or fields. |
|
titleQuery ( ) |
Returns query which selects title field |
|
tryDelete ( $id = null ) |
Tries to delete record, but does nothing if not found |
|
tryLoad ( $id ) |
Try to load a record by specified ID. Will not raise exception if record is not found |
|
tryLoadAny ( ) |
Try to load a matching record for the model. Will not raise exception if no records are found |
|
tryLoadBy ( $field, $cond = UNDEFINED, $value = UNDEFINED ) |
Attempt to load using a specified condition, but will not fail if such record is not found |
|
tryLoadRandom ( ) |
Loads random entry into model |
|
unload ( ) |
forget currently loaded record and it's ID. Will not affect database |
|
unserialize ( $data ) |
|
|
update ( $data = [] ) |
|
|
valid ( ) |
|
|