Agile Toolkit  4.2
Agile Toolkit is a powerful web development framework. Inspired by GUI Applications development
Model Class Reference
Inheritance diagram for Model:
AbstractModel AbstractObject Model_Table ModelIO

Public Member Functions

 init ()
 __clone ()
 addField ($name)
 set ($name, $value=undefined)
 get ($name=null)
 setDirty ($name)
 loaded ()
 unload ()
 reset ()
 setSource ($controller, $table=null, $id=null)
 {{{ Operation with external Data Controllers
 load ($id=null)
 save ($id=null)
 delete ($id=null)
 offsetExists ($name)
 }}}
 offsetGet ($name)
 offsetSet ($name, $val)
 offsetUnset ($name)
 rewind ()
 next ()
 current ()
 key ()
 valid ()
 newField ($name)
 hasField ($name)
 getEntityCode ()
 getField ($f)

Data Fields

 $default_exception = 'Exception'
 $field_class = 'Field'
 $strict_fields = false
 $table
 $id = null
 $data = array()
 $dirty = array()

Detailed Description


Member Function Documentation

__clone ( )

Reimplemented from AbstractObject.

Reimplemented in Model_Table.

addField ( name)

Creates field definition object containing field meta-information such as caption, type validation rules, default value etc

current ( )

Reimplemented in Model_Table.

delete ( id = null)

Deletes record associated with specified $id. If not specified, currently loaded record is deleted (and unloaded)

Reimplemented in Model_Table.

get ( name = null)

Return value of the field. If unspecified will return array of all fields.

getField ( f)
hasField ( name)
init ( )

Initialize object. Always call parent

This method is called for initialization

Reimplemented from AbstractObject.

Reimplemented in Model_Table.

key ( )

Reimplemented in Model_Table.

load ( id = null)

Attempt to load record with specified ID. If this fails, no error is produced

Reimplemented in Model_Table.

loaded ( )

Returns if the records has been loaded successfully

newField ( name)
next ( )

Reimplemented in Model_Table.

offsetExists ( name)

}}}

offsetGet ( name)
offsetSet ( name,
val 
)
offsetUnset ( name)
reset ( )
rewind ( )

Reimplemented in Model_Table.

save ( id = null)

Saves record with current controller. If no argument is specified, uses $this->id. Specifying "false" will create record with new ID. Returns ID of saved record

set ( name,
value = undefined 
)

Set value of the field. If $this->strict_fields, will throw exception for non-existant fields. Can also accept array

setDirty ( name)

When fields are changed, they are marked dirty. Only dirty fields are saved when save() is called

setSource ( controller,
table = null,
id = null 
)

{{{ Operation with external Data Controllers

Associates appropriate controller and loads data such as 'Array' for Controller_Data_Array class

unload ( )

Forget loaded data

Reimplemented in Model_Table.

valid ( )

Reimplemented in Model_Table.


Field Documentation

$data = array()
$default_exception = 'Exception'

Exception class to use when $this->exception() is called

Reimplemented from AbstractObject.

$dirty = array()
$field_class = 'Field'

The class prefix used by addField

$id = null

Contains identifier of currently loaded record or null. Use load() and reset()

$strict_fields = false

If true, model will now allow to set values for non-existant fields

$table

Contains information about table/file/bucket/array used by Controller to determine source


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations