Class WsModel
WsModel Is model part of Model-View-Controller. WsModel is the base class providing the common features needed by data model objects.
Example usage:
class TestModel extends WsModel { public function __construct() { // autodetect columns, column types, etc parent::__construct(); // change some column types // change column type for column $this->columnType['enter_date'] = 'date_type'; // change column type for other column $this->columnType['is_checked'] = 'bool_type'; // leave other column types unchanged (autodetected) } } // use model $m = new TestModel(); // get one record with ID 100 from database $m->getOne(100); // show field value for retrived record echo $m->name.'\n'; // change value of one column in record with ID 100 $m->name = 'New Name'; // save changes $m->save(); // delete record with ID 100 from database $m->id = 100; $m->delete(); // same as above $m->delete(100);
- WsDatabase
-
WsModel
Direct known subclasses
Ws_logged_inModel, Ws_permissionsModel, Ws_role_permModel, Ws_rolesModel, Ws_user_roleModel, Ws_userModel
public
|
|
public
|
#
setTableName( string $name )
Sets name of database table on which model references. Also updates all propertyes that hold informations about table columns: $column $columnCanBeNull $columnHeaders $foreignKeys $primaryKey |
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
array
|
|
public
array
|
|
public
array
|
|
public
integer
|
__destruct(),
close(),
execute(),
execute_batch(),
query()
|
public
string
|
$className
$className Name of model |
#
''
|
public
string
|
$tableName
$tableName Name of database table |
#
''
|
public
string
|
$metaName
$metaName Long name (description) of database table |
#
''
|
public
array
|
$columns
List of table columns. This list is automaticaly populated during the class initialization. |
#
array()
|
public
string
|
$primary_key
$primary_key Column that is primary key |
#
'id'
|
public
array
|
$columnCanBeNull
$columnCanBeNull List of columns that can store NULL values |
#
array()
|
public
array
|
$columnType
$columnType List of column types |
#
array()
|
public
array
|
$columnHeaders
$columnHeaders List of column headers |
#
array()
|
public
array
|
$foreignKeys
List of arrays wich represents relations between two WsModel classes. This list is automaticaly populated during the class initialization with regresion that display properti is referencing to foreign column name. |
#
array()
|
$isConnected,
$nRows
|