Properties

$parent

$parent : 

Type

$auto_save

$auto_save : 

Type

$new_query_fields

$new_query_fields : 

Type

$data

$data : 

Type

$table

$table : 

Type

$modified_data

$modified_data : 

Type

$save_value

$save_value : 

Type

$primary_key

$primary_key : 

Type

$aliases

$aliases : 

Type

$auto_generated_pk

$auto_generated_pk : 

Type

Methods

__construct()

__construct(  $data,   $parent,   $table,   $primary_key = Null) 

Parameters

$data
$parent
$table
$primary_key

__set()

__set(  $field,   $value) 

Set a database field.

Unless $auto_generated_pk is set to False, this will throw an exception if you try to set the value of the primary key.

Parameters

$field
$value

restore()

restore(  $name) 

Restore the previous value (we only store one.) Does not work with auto_save turned on.

Parameters

$name

undo()

undo() 

Undo all modifications.

Does not work with auto_save turned on.

__get()

__get(  $field) 

Get a database field.

Parameters

$field

__isset()

__isset(  $name) 

See if a database field is set.

For the purposes of this method, '' is considered unset.

Parameters

$name

__unset()

__unset(  $name) 

Sets a field to null.

Parameters

$name

offsetExists()

offsetExists(  $name) 

ArrayAccess interface, alias to __isset().

Parameters

$name

offsetSet()

offsetSet(  $name,   $value) 

ArrayAccess interface, alias to __set().

Parameters

$name
$value

offsetUnset()

offsetUnset(  $name) 

ArrayAccess interface, alias to __unset().

Parameters

$name

offsetGet()

offsetGet(  $name) 

ArrayAccess interface, alias to __get().

Parameters

$name

save()

save() 

Save our data back to the database.

If the primary key is set, and has not been modified, this will update the existing record with the new data.

If the primary key has not been set, or has been modified, this will insert a new record into the database, and in the case of auto-generated primary keys, update our primary key field to point to the new record.

delete()

delete() 

Delete this item from the database.

start_batch()

start_batch() 

Start a batch operation.

We disable the 'auto_save' feature, saving its value for later.

end_batch()

end_batch() 

Finish a batch operation.

We restore the auto_save value, and if it was true, save the data.

cancel_batch()

cancel_batch() 

Cancel a batch operation.

We run $this->undo() and then restore the auto_save value.

_get_headers()

_get_headers() 

_set_headers()

_set_headers(  $headers) 

Parameters

$headers

_get_context()

_get_context() 

_set_context()

_set_context(  $context) 

Parameters

$context

_get_userdata()

_get_userdata() 

_set_userdata()

_set_userdata(  $user) 

Parameters

$user

db_field()

db_field(  $name,   $strict = True) 

Look for a field

If the field exists in the database, it's returned unchanged.

If an alias exists, the alias target field will be returned.

If neither exists, and the field is not the primary key, an exception will be thrown.

Parameters

$name
$strict

get_field()

get_field(  $field) 

Parameters

$field

set_field()

set_field(  $field,   $data) 

Parameters

$field
$data