Jeff PHP framework
0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
|
Model class of the MVC pattern, is the class used to represent a database record object. More...
Public Member Functions | |
__construct ($id, $table=null) | |
Constructs a model instance. | |
__get ($pName) | |
Getter method. | |
__set ($pName, $value) | |
Setter method. | |
deleteData () | |
Deletes the object properties from database. | |
saveData ($insert=false) | |
Saves the model object. | |
setIdName ($id_name) | |
Setter method for $_id_name property. | |
setTable ($table) | |
Setter method for $_tbl_data property. | |
Protected Member Functions | |
initDbProp ($id) | |
Model initialization. | |
initNullProp () | |
Initialization of an empty model object. | |
Protected Attributes | |
$_chgP = array() | |
changed model properties | |
$_id_name = 'id' | |
the name of the primary key field | |
$_p = array() | |
model properties | |
$_registry | |
the registry singleton instance | |
$_tbl_data = '' | |
the database table of the model |
Model class of the MVC pattern, is the class used to represent a database record object.
This is the general model class extended by all specific module models. It acts like an interface to the database table which stores the module data and so has:
A Model instance represents a record of a database table.
Each model stores all the record field values as elements of a property array. Each model property value can be retrieved calling it as a normal property.
i.e. $model->field is the same as $model->_p['field'] and contains the value of 'field' for the represented record.
Definition at line 41 of file model.class.php.
model::__construct | ( | $ | id, |
$ | table = null |
||
) |
Constructs a model instance.
mixed | $id | the identifier of the record (the primary key value) |
mixed | $table | the model database table. Default null (may be set after object construction) |
Definition at line 80 of file model.class.php.
model::__get | ( | $ | pName | ) |
Getter method.
Returns the value of the given property. Calls the specific property getter method if exists, otherwise returns directly its value.
string | $pName | the property name |
Definition at line 166 of file model.class.php.
model::__set | ( | $ | pName, |
$ | value | ||
) |
Setter method.
Sets the value of the given property. Calls a specific property setter method if exists.
string | $pName | the property name |
mixed | $value | the property value |
Definition at line 183 of file model.class.php.
Deletes the object properties from database.
Definition at line 224 of file model.class.php.
model::initDbProp | ( | $ | id | ) | [protected] |
Model initialization.
Initializes the model object retrieving data from the database. If the record still doesn't exist, returns an associative array with all null values.
mixed | $id | the identifier of the record (the primary key value) |
Definition at line 123 of file model.class.php.
model::initNullProp | ( | ) | [protected] |
Initialization of an empty model object.
Definition at line 147 of file model.class.php.
model::saveData | ( | $ | insert = false | ) |
Saves the model object.
Stores the object properties in the database.
bool | $insert | force new record insertion |
Definition at line 203 of file model.class.php.
model::setIdName | ( | $ | id_name | ) |
Setter method for $_id_name property.
mixed | $id_name | the name of the primary key |
Definition at line 96 of file model.class.php.
model::setTable | ( | $ | table | ) |
Setter method for $_tbl_data property.
string | $table | the model database table |
Definition at line 108 of file model.class.php.
model::$_chgP = array() [protected] |
changed model properties
an array an array containing the list of changed model properties
Definition at line 55 of file model.class.php.
model::$_id_name = 'id' [protected] |
the name of the primary key field
Definition at line 71 of file model.class.php.
model::$_p = array() [protected] |
model properties
an associative array containing the record fields name and their value
Definition at line 48 of file model.class.php.
model::$_registry [protected] |
the registry singleton instance
Definition at line 66 of file model.class.php.
model::$_tbl_data = '' [protected] |
the database table of the model
Definition at line 61 of file model.class.php.