BasicModel::__construct |
( |
|
$con) | |
|
Create the table
- Returns
- boolean
BasicModel::createIfNeeded |
( |
|
$db_name) | |
|
Create structure only if it does not exist
- Parameters
-
$db_name | [string] database name |
- Returns
- [keyed array] db => database name struct => table/view name error => [int] error code details => error details
Delete record from the database. Requires a uniqueness constraint. Assign those columns before calling delete().
- Returns
- boolean
BasicModel::find |
( |
|
$sort = '' , |
|
|
|
$reverse = false |
|
) |
| |
Find records that match this instance
- Parameters
-
$sort | array of columns to sort by |
- Returns
- an array of controller objects
BasicModel::generate |
( |
|
$filename) | |
|
Rewrite the given file to create accessor functions for all of its columns
BasicModel::getMeta |
( |
|
$type, |
|
|
|
$dbms |
|
) |
| |
|
protected |
Get database-specific type
- Parameters
-
$type | a "meta-type" with different underlying type depending on the DB |
$dbms | string DB name |
- Returns
- string
BasicModel::getModels |
( |
) | |
|
Experiment using lambdas. I was curious if I could do recursion without having a named function.
BasicModel::insertRecord |
( |
) | |
|
|
protected |
Helper. Build & execute insert query
- Returns
- SQL result object or boolean false
Populate instance with database values Requires a uniqueness constraint. Assign those columns before calling load().
- Returns
- boolean
Lane implementation lacks server methods: pushToLanes() deleteFromLanes() normalizeLanes() Compare existing table to definition Add any columns that are missing from the table structure Extra columns that are present in the table but not in the controlelr class are left as-is.
- Parameters
-
$db_name | name of the database containing the table |
$mode | the normalization mode. See above. |
- Returns
- number of columns added or False on failure
Allow for db other than main ones, e.g. for a plugin. Force a new connection to avoid messing with the one maintained by the Database class
Save current record. If a uniqueness constraint is defined it will INSERT or UPDATE appropriately.
- Returns
- SQL result object or boolean false
BasicModel::updateRecord |
( |
) | |
|
|
protected |
Helper. Build & execute update query
- Returns
- SQL result object or boolean false
BasicModel::$columns = array() |
|
protected |
Definition of columns. Keyed by column name. Values should be arrays with keys for:
- type (required)
- default (null if omitted)
- primary_key (optional, boolean)
- index (optional, boolean)
- increment (optional, boolean)
BasicModel::$connection = false |
|
protected |
BasicModel::$instance = array() |
|
protected |
List of column names => values
Initial value:= array(
'MONEY' => array('default'=>'DECIMAL(10,2)','mssql'=>'MONEY')
)
Type transalations for different DB backends.
BasicModel::$preferred_db = '' |
|
protected |
Name of preferred database
BasicModel::$unique = array() |
|
protected |
List of columns that should be unique per record. Only necessary if the table has no primary key.
const BasicModel::NORMALIZE_MODE_APPLY = 2 |
const BasicModel::NORMALIZE_MODE_CHECK = 1 |
check for potential changes
The documentation for this class was generated from the following file:
- pos/is4c-nf/lib/models/BasicModel.php