Model class for all business DAO objects

package salt\dao

 Methods

Create a Model object

__construct(string $objectClassName) 

Parameters

$objectClassName

string

class name of the model object

Return a field metadata

__get(string $field) : \salt\Field

Parameters

$field

string

field name

Returns

\salt\Fieldthe field metadata

Check if a field exists

exists(string $field) : boolean

Parameters

$field

string

field name

Returns

booleanTRUE if field is registered, FALSE otherwise

Return the class name of the object linked to the model

getClass() : string

Returns

stringa child class name of Base

Return all fields

getFields() : array<mixed,\salt\Field>

Returns

array<mixed,\salt\Field>fields indexed by field name

Return the name of the main ID field registered with registerId()

getIdFieldName() : string

Returns

stringthe name of the ID field

Return the table name registered with registerTableName()

getTableName() : string

Returns

stringthe table name

Check if the model is initialized

initialized() : boolean

Returns

booleanTRUE if model is initialized, FALSE otherwise

Register fields

registerFields(\salt\Field $args) : \salt\Model

Parameters

$args

\salt\Field

... list of fields

Returns

\salt\Modelthis object

Register the fieldName will be returned by Base::getId()

registerId(string $fieldName) : \salt\Model
see

Parameters

$fieldName

string

a field name registered in metadata()

Returns

\salt\Modelthis object

Register the table name of the object in database

registerTableName(string $table) : \salt\Model

Parameters

$table

string

the table name that will be used in query generation

Returns

\salt\Modelthis object

Set the model to initialized state.

setInitialized() 

No modification can be done to the model after that.

Throw exception if called after model was initialized

checkChangeAfterInit() 

Exceptions

\salt\SaltException if called after setInitialized()

 Properties

 

the real class name of the object

$_salt_class : string

Default

NULL
 

all field of the object, indexed by field name

$_salt_fields : array<mixed,\salt\Field>

Default

array()
 

name of the main id field

$_salt_idFieldName : string

Default

NULL
 

TRUE if initialized

$_salt_initialized : boolean

Default

FALSE
 

table name of the dao object

$_salt_tableName : string

Default

NULL