Model Class Reference

Public Member Functions | |
| _clearCache ($type=null) | |
| _clearCache ($type=null) | |
| _deleteHasMany ($id, $cascade) | |
| _deleteHasMany ($id, $cascade) | |
| _deleteHasOne ($id, $cascade) | |
| _deleteHasOne ($id, $cascade) | |
| _deleteMulti ($id) | |
| _deleteMulti ($id) | |
| afterDelete () | |
| afterDelete () | |
| afterFind ($results) | |
| afterFind ($results) | |
| afterSave () | |
| afterSave () | |
| beforeDelete () | |
| beforeDelete () | |
| beforeFind (&$queryData) | |
| beforeFind (&$queryData) | |
| beforeSave () | |
| beforeSave () | |
| beforeValidate () | |
| beforeValidate () | |
| bindModel ($params) | |
| bindModel ($params) | |
| create () | |
| create () | |
| del ($id=null, $cascade=true) | |
| del ($id=null, $cascade=true) | |
| delete ($id=null, $cascade=true) | |
| delete ($id=null, $cascade=true) | |
| escapeField ($field) | |
| escapeField ($field) | |
| execute ($data) | |
| execute ($data) | |
| exists () | |
| exists () | |
| field ($name, $conditions=null, $order=null) | |
| field ($name, $conditions=null, $order=null) | |
| find ($conditions=null, $fields=null, $order=null, $recursive=null) | |
| find ($conditions=null, $fields=null, $order=null, $recursive=null) | |
| findAll ($conditions=null, $fields=null, $order=null, $limit=null, $page=1, $recursive=null) | |
| findAll ($conditions=null, $fields=null, $order=null, $limit=null, $page=1, $recursive=null) | |
| findAllThreaded ($conditions=null, $fields=null, $sort=null) | |
| findAllThreaded ($conditions=null, $fields=null, $sort=null) | |
| findBySql ($sql) | |
| findBySql ($sql) | |
| findCount ($conditions=null, $recursive=0) | |
| findCount ($conditions=null, $recursive=0) | |
| findNeighbours ($conditions=null, $field, $value) | |
| findNeighbours ($conditions=null, $field, $value) | |
| generateList ($conditions=null, $order=null, $limit=null, $keyPath=null, $valuePath=null) | |
| generateList ($conditions=null, $order=null, $limit=null, $keyPath=null, $valuePath=null) | |
| getAffectedRows () | |
| getAffectedRows () | |
| getColumnType ($column) | |
| getColumnType ($column) | |
| getColumnTypes () | |
| getColumnTypes () | |
| getDisplayField () | |
| getDisplayField () | |
| getID ($list=0) | |
| getID ($list=0) | |
| getInsertID () | |
| getInsertID () | |
| getLastInsertID () | |
| getLastInsertID () | |
| getNumRows () | |
| getNumRows () | |
| hasAny ($conditions=null) | |
| hasAny ($conditions=null) | |
| hasField ($name) | |
| hasField ($name) | |
| invalidate ($field) | |
| invalidate ($field) | |
| invalidFields ($data=array()) | |
| invalidFields ($data=array()) | |
| isForeignKey ($field) | |
| isForeignKey ($field) | |
| loadInfo () | |
| loadInfo () | |
| onError () | |
| onError () | |
| query () | |
| query () | |
| read ($fields=null, $id=null) | |
| read ($fields=null, $id=null) | |
| remove ($id=null, $cascade=true) | |
| remove ($id=null, $cascade=true) | |
| save ($data=null, $validate=true, $fieldList=array()) | |
| save ($data=null, $validate=true, $fieldList=array()) | |
| saveField ($name, $value, $validate=false) | |
| saveField ($name, $value, $validate=false) | |
| set ($one, $two=null) | |
| set ($one, $two=null) | |
| setDataSource ($dataSource=null) | |
| setDataSource ($dataSource=null) | |
| setId ($id) | |
| setId ($id) | |
| setInsertID ($id) | |
| setInsertID ($id) | |
| setSource ($tableName) | |
| setSource ($tableName) | |
| unbindModel ($params) | |
| unbindModel ($params) | |
| validates ($data=array()) | |
| validates ($data=array()) | |
Public Attributes | |
| $_tableInfo = null | |
| $alias = null | |
| $belongsTo = array() | |
| $cacheQueries = true | |
| $cacheSources = true | |
| $currentModel = null | |
| $data = array() | |
| $displayField = null | |
| $hasAndBelongsToMany = array() | |
| $hasMany = array() | |
| $hasOne = array() | |
| $id = false | |
| $keyToTable = array() | |
| $logTransactions = false | |
| $modelToTable = array() | |
| $name = null | |
| $primaryKey = null | |
| $recursive = 1 | |
| $table = false | |
| $tablePrefix = null | |
| $tableToModel = array() | |
| $transactional = false | |
| $useDbConfig = 'default' | |
| $useTable = null | |
| $validate = array() | |
| $validationErrors = array() | |
| $whitelist = array() | |
Detailed Description
Definition at line 45 of file model_php4.php.
Member Function Documentation
| Model::_clearCache | ( | $ | type = null |
) |
Private method. Clears cache for this model
- Parameters:
-
string $type If null this deletes cached views if CACHE_CHECK is true Will be used to allow deleting query cache also
- Returns:
- boolean true on delete protected
Definition at line 1676 of file model_php5.php.
References Inflector::pluralize().
| Model::_clearCache | ( | $ | type = null |
) |
Private method. Clears cache for this model
- Parameters:
-
string $type If null this deletes cached views if CACHE_CHECK is true Will be used to allow deleting query cache also
- Returns:
- boolean true on delete protected
Definition at line 1675 of file model_php4.php.
References Inflector::pluralize().
| Model::_deleteHasMany | ( | $ | id, | |
| $ | cascade | |||
| ) |
Cascades model deletes to hasMany relationships.
- Parameters:
-
string $id
- Returns:
- null protected
Definition at line 1038 of file model_php5.php.
References $data.
| Model::_deleteHasMany | ( | $ | id, | |
| $ | cascade | |||
| ) |
Cascades model deletes to hasMany relationships.
- Parameters:
-
string $id
- Returns:
- null protected
Definition at line 1037 of file model_php4.php.
References $data.
| Model::_deleteHasOne | ( | $ | id, | |
| $ | cascade | |||
| ) |
Cascades model deletes to hasOne relationships.
- Parameters:
-
string $id
- Returns:
- null protected
Definition at line 1068 of file model_php5.php.
References $data.
| Model::_deleteHasOne | ( | $ | id, | |
| $ | cascade | |||
| ) |
Cascades model deletes to hasOne relationships.
- Parameters:
-
string $id
- Returns:
- null protected
Definition at line 1067 of file model_php4.php.
References $data.
| Model::_deleteMulti | ( | $ | id | ) |
Cascades model deletes to HABTM join keys.
- Parameters:
-
string $id
- Returns:
- null protected
Definition at line 1098 of file model_php5.php.
References $data, and ConnectionManager::getDataSource().
| Model::_deleteMulti | ( | $ | id | ) |
Cascades model deletes to HABTM join keys.
- Parameters:
-
string $id
- Returns:
- null protected
Definition at line 1097 of file model_php4.php.
References $data, and ConnectionManager::getDataSource().
| Model::afterDelete | ( | ) |
| Model::afterDelete | ( | ) |
| Model::afterFind | ( | $ | results | ) |
After find callback. Can be used to modify any results returned by find and findAll.
- Parameters:
-
mixed $results The results of the find operation
- Returns:
- mixed Result of the find operation public
Definition at line 1613 of file model_php5.php.
| Model::afterFind | ( | $ | results | ) |
After find callback. Can be used to modify any results returned by find and findAll.
- Parameters:
-
mixed $results The results of the find operation
- Returns:
- mixed Result of the find operation public
Definition at line 1612 of file model_php4.php.
| Model::afterSave | ( | ) |
| Model::afterSave | ( | ) |
| Model::beforeDelete | ( | ) |
Before delete callback
- Returns:
- boolean True if the operation should continue, false if it should abort public
Definition at line 1640 of file model_php5.php.
| Model::beforeDelete | ( | ) |
Before delete callback
- Returns:
- boolean True if the operation should continue, false if it should abort public
Definition at line 1639 of file model_php4.php.
| Model::beforeFind | ( | &$ | queryData | ) |
Before find callback
- Parameters:
-
array $queryData Data used to execute this query, i.e. conditions, order, etc.
- Returns:
- boolean True if the operation should continue, false if it should abort public
Definition at line 1603 of file model_php5.php.
| Model::beforeFind | ( | &$ | queryData | ) |
Before find callback
- Parameters:
-
array $queryData Data used to execute this query, i.e. conditions, order, etc.
- Returns:
- boolean True if the operation should continue, false if it should abort public
Definition at line 1602 of file model_php4.php.
| Model::beforeSave | ( | ) |
Before save callback
- Returns:
- boolean True if the operation should continue, false if it should abort public
Definition at line 1622 of file model_php5.php.
| Model::beforeSave | ( | ) |
Before save callback
- Returns:
- boolean True if the operation should continue, false if it should abort public
Definition at line 1621 of file model_php4.php.
| Model::beforeValidate | ( | ) |
| Model::beforeValidate | ( | ) |
| Model::bindModel | ( | $ | params | ) |
Bind model associations on the fly.
- Parameters:
-
array $params
- Returns:
- true public
Definition at line 371 of file model_php5.php.
| Model::bindModel | ( | $ | params | ) |
Bind model associations on the fly.
- Parameters:
-
array $params
- Returns:
- true public
Definition at line 378 of file model_php4.php.
| Model::create | ( | ) |
Initializes the model for writing a new record.
- Returns:
- boolean True public
Definition at line 692 of file model_php5.php.
| Model::create | ( | ) |
Initializes the model for writing a new record.
- Returns:
- boolean True public
Definition at line 699 of file model_php4.php.
| Model::del | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
Removes record for given id. If no id is given, the current id is used. Returns true on success.
- Parameters:
-
mixed $id Id of record to delete
- Returns:
- boolean True on success public
Definition at line 997 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::del | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
Removes record for given id. If no id is given, the current id is used. Returns true on success.
- Parameters:
-
mixed $id Id of record to delete
- Returns:
- boolean True on success public
Definition at line 996 of file model_php4.php.
References ConnectionManager::getDataSource().
| Model::delete | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
Alias for del()
- Parameters:
-
mixed $id Id of record to delete
- Returns:
- boolean True on success public
Definition at line 1028 of file model_php5.php.
| Model::delete | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
Alias for del()
- Parameters:
-
mixed $id Id of record to delete
- Returns:
- boolean True on success public
Definition at line 1027 of file model_php4.php.
| Model::escapeField | ( | $ | field | ) |
Escapes the field name and prepends the model name. Escaping will be done according to the current database driver's rules.
- Parameters:
-
unknown_type $field
- Returns:
- string The name of the escaped field for this Model (i.e. id becomes `Post`.`id`). public
Definition at line 1498 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::escapeField | ( | $ | field | ) |
Escapes the field name and prepends the model name. Escaping will be done according to the current database driver's rules.
- Parameters:
-
unknown_type $field
- Returns:
- string The name of the escaped field for this Model (i.e. id becomes `Post`.`id`). public
Definition at line 1497 of file model_php4.php.
References ConnectionManager::getDataSource().
| Model::execute | ( | $ | data | ) |
Runs a direct query against the bound DataSource, and returns the result.
- Parameters:
-
string $data Query data
- Returns:
- array public
Definition at line 1232 of file model_php5.php.
References $data, and ConnectionManager::getDataSource().
| Model::execute | ( | $ | data | ) |
Runs a direct query against the bound DataSource, and returns the result.
- Parameters:
-
string $data Query data
- Returns:
- array public
Definition at line 1231 of file model_php4.php.
References $data, and ConnectionManager::getDataSource().
| Model::exists | ( | ) |
Returns true if a record with set id exists.
- Returns:
- boolean True if such a record exists public
Definition at line 1110 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::exists | ( | ) |
Returns true if a record with set id exists.
- Returns:
- boolean True if such a record exists public
Definition at line 1109 of file model_php4.php.
References ConnectionManager::getDataSource().
| Model::field | ( | $ | name, | |
| $ | conditions = null, |
|||
| $ | order = null | |||
| ) |
Returns contents of a field in a query matching given conditions.
- Parameters:
-
string $name Name of field to get array $conditions SQL conditions (defaults to NULL) string $order SQL ORDER BY fragment
- Returns:
- field contents public
Definition at line 749 of file model_php5.php.
References $data.
| Model::field | ( | $ | name, | |
| $ | conditions = null, |
|||
| $ | order = null | |||
| ) |
Returns contents of a field in a query matching given conditions.
- Parameters:
-
string $name Name of field to get array $conditions SQL conditions (defaults to NULL) string $order SQL ORDER BY fragment
- Returns:
- field contents public
Definition at line 756 of file model_php4.php.
References $data.
| Model::find | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | order = null, |
|||
| $ | recursive = null | |||
| ) |
Return a single row as a resultset array. By using the $recursive parameter, the call can access further "levels of association" than the ones this model is directly associated to.
- Parameters:
-
array $conditions SQL conditions array mixed $fields Either a single string of a field name, or an array of field names string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") int $recursive The number of levels deep to fetch associated records
- Returns:
- array Array of records public
Definition at line 1145 of file model_php5.php.
References $data.
| Model::find | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | order = null, |
|||
| $ | recursive = null | |||
| ) |
Return a single row as a resultset array. By using the $recursive parameter, the call can access further "levels of association" than the ones this model is directly associated to.
- Parameters:
-
array $conditions SQL conditions array mixed $fields Either a single string of a field name, or an array of field names string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") int $recursive The number of levels deep to fetch associated records
- Returns:
- array Array of records public
Definition at line 1144 of file model_php4.php.
References $data.
Referenced by AclNode::create(), AclNode::delete(), AclNode::getChildren(), AclNode::getPath(), Cache::has(), AclNode::id(), Cache::restore(), and AclNode::setParent().
| Model::findAll | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | order = null, |
|||
| $ | limit = null, |
|||
| $ | page = 1, |
|||
| $ | recursive = null | |||
| ) |
Returns a resultset array with specified fields from database matching given conditions. By using the $recursive parameter, the call can access further "levels of association" than the ones this model is directly associated to.
- Parameters:
-
mixed $conditions SQL conditions as a string or as an array('field' =>'value',...) mixed $fields Either a single string of a field name, or an array of field names string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") int $limit SQL LIMIT clause, for calculating items per page. int $page Page number, for accessing paged data int $recursive The number of levels deep to fetch associated records
- Returns:
- array Array of records public
Definition at line 1168 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::findAll | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | order = null, |
|||
| $ | limit = null, |
|||
| $ | page = 1, |
|||
| $ | recursive = null | |||
| ) |
Returns a resultset array with specified fields from database matching given conditions. By using the $recursive parameter, the call can access further "levels of association" than the ones this model is directly associated to.
- Parameters:
-
mixed $conditions SQL conditions as a string or as an array('field' =>'value',...) mixed $fields Either a single string of a field name, or an array of field names string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") int $limit SQL LIMIT clause, for calculating items per page. int $page Page number, for accessing paged data int $recursive The number of levels deep to fetch associated records
- Returns:
- array Array of records public
Definition at line 1167 of file model_php4.php.
References ConnectionManager::getDataSource().
Referenced by AclNode::delete(), findAllThreaded(), findNeighbours(), AclNode::getChildren(), and AclNode::getPath().
| Model::findAllThreaded | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | sort = null | |||
| ) |
Special findAll variation for tables joined to themselves. The table needs the fields id and parent_id to work.
- Parameters:
-
array $conditions Conditions for the findAll() call array $fields Fields for the findAll() call string $sort SQL ORDER BY statement
- Returns:
- array public
Definition at line 1283 of file model_php5.php.
References findAll().
| Model::findAllThreaded | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | sort = null | |||
| ) |
Special findAll variation for tables joined to themselves. The table needs the fields id and parent_id to work.
- Parameters:
-
array $conditions Conditions for the findAll() call array $fields Fields for the findAll() call string $sort SQL ORDER BY statement
- Returns:
- array public
Definition at line 1282 of file model_php4.php.
References findAll().
| Model::findBySql | ( | $ | sql | ) |
| Model::findBySql | ( | $ | sql | ) |
| Model::findCount | ( | $ | conditions = null, |
|
| $ | recursive = 0 | |||
| ) |
Returns number of rows matching given SQL condition.
- Parameters:
-
array $conditions SQL conditions array for findAll int $recursize The number of levels deep to fetch associated records
- Returns:
- int Number of matching rows
- See also:
- Model::findAll public
Definition at line 1259 of file model_php5.php.
References $data, and ConnectionManager::getDataSource().
| Model::findCount | ( | $ | conditions = null, |
|
| $ | recursive = 0 | |||
| ) |
Returns number of rows matching given SQL condition.
- Parameters:
-
array $conditions SQL conditions array for findAll int $recursize The number of levels deep to fetch associated records
- Returns:
- int Number of matching rows
- See also:
- Model::findAll public
Definition at line 1258 of file model_php4.php.
References $data, and ConnectionManager::getDataSource().
| Model::findNeighbours | ( | $ | conditions = null, |
|
| $ | field, | |||
| $ | value | |||
| ) |
Returns an array with keys "prev" and "next" that holds the id's of neighbouring data, which is useful when creating paged lists.
- Parameters:
-
string $conditions SQL conditions for matching rows string $field Field name (parameter for findAll) unknown_type $value
- Returns:
- array Array with keys "prev" and "next" that holds the id's public
Definition at line 1325 of file model_php5.php.
References findAll(), and ConnectionManager::getDataSource().
| Model::findNeighbours | ( | $ | conditions = null, |
|
| $ | field, | |||
| $ | value | |||
| ) |
Returns an array with keys "prev" and "next" that holds the id's of neighbouring data, which is useful when creating paged lists.
- Parameters:
-
string $conditions SQL conditions for matching rows string $field Field name (parameter for findAll) unknown_type $value
- Returns:
- array Array with keys "prev" and "next" that holds the id's public
Definition at line 1324 of file model_php4.php.
References findAll(), and ConnectionManager::getDataSource().
| Model::generateList | ( | $ | conditions = null, |
|
| $ | order = null, |
|||
| $ | limit = null, |
|||
| $ | keyPath = null, |
|||
| $ | valuePath = null | |||
| ) |
Returns a resultset array with specified fields from database matching given conditions. Method can be used to generate option lists for SELECT elements.
- Parameters:
-
mixed $conditions SQL conditions as a string or as an array('field' =>'value',...) string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") int $limit SQL LIMIT clause, for calculating items per page string $keyPath A string path to the key, i.e. "{n}.Post.id" string $valuePath A string path to the value, i.e. "{n}.Post.title"
- Returns:
- array An associative array of records, where the id is the key, and the display field is the value public
Definition at line 1456 of file model_php5.php.
References Set::extract().
| Model::generateList | ( | $ | conditions = null, |
|
| $ | order = null, |
|||
| $ | limit = null, |
|||
| $ | keyPath = null, |
|||
| $ | valuePath = null | |||
| ) |
Returns a resultset array with specified fields from database matching given conditions. Method can be used to generate option lists for SELECT elements.
- Parameters:
-
mixed $conditions SQL conditions as a string or as an array('field' =>'value',...) string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") int $limit SQL LIMIT clause, for calculating items per page string $keyPath A string path to the key, i.e. "{n}.Post.id" string $valuePath A string path to the value, i.e. "{n}.Post.title"
- Returns:
- array An associative array of records, where the id is the key, and the display field is the value public
Definition at line 1455 of file model_php4.php.
References Set::extract().
| Model::getAffectedRows | ( | ) |
Returns the number of rows affected by the last query
- Returns:
- int public
Definition at line 1571 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::getAffectedRows | ( | ) |
Returns the number of rows affected by the last query
- Returns:
- int public
Definition at line 1570 of file model_php4.php.
References ConnectionManager::getDataSource().
| Model::getColumnType | ( | $ | column | ) |
Returns the column type of a column in the model
- Parameters:
-
string $column The name of the model column
- Returns:
- string public
Definition at line 648 of file model_php5.php.
References loadInfo().
| Model::getColumnType | ( | $ | column | ) |
Returns the column type of a column in the model
- Parameters:
-
string $column The name of the model column
- Returns:
- string public
Definition at line 655 of file model_php4.php.
References loadInfo().
| Model::getColumnTypes | ( | ) |
Returns an associative array of field names and column types.
- Returns:
- array public
Definition at line 630 of file model_php5.php.
References ConnectionManager::getDataSource(), and loadInfo().
| Model::getColumnTypes | ( | ) |
Returns an associative array of field names and column types.
- Returns:
- array public
Definition at line 637 of file model_php4.php.
References ConnectionManager::getDataSource(), and loadInfo().
| Model::getDisplayField | ( | ) |
Gets the display field for this model
- Returns:
- string The name of the display field for this Model (i.e. 'name', 'title'). public
Definition at line 1441 of file model_php5.php.
| Model::getDisplayField | ( | ) |
Gets the display field for this model
- Returns:
- string The name of the display field for this Model (i.e. 'name', 'title'). public
Definition at line 1440 of file model_php4.php.
| Model::getID | ( | $ | list = 0 |
) |
Returns the current record's ID
- Parameters:
-
unknown_type $list
- Returns:
- mixed The ID of the current record public
Definition at line 1509 of file model_php5.php.
| Model::getID | ( | $ | list = 0 |
) |
Returns the current record's ID
- Parameters:
-
unknown_type $list
- Returns:
- mixed The ID of the current record public
Definition at line 1508 of file model_php4.php.
| Model::getInsertID | ( | ) |
Returns the ID of the last record this Model inserted
- Returns:
- mixed public
Definition at line 1543 of file model_php5.php.
| Model::getInsertID | ( | ) |
Returns the ID of the last record this Model inserted
- Returns:
- mixed public
Definition at line 1542 of file model_php4.php.
| Model::getLastInsertID | ( | ) |
Returns the ID of the last record this Model inserted
- Returns:
- mixed public
Definition at line 1534 of file model_php5.php.
| Model::getLastInsertID | ( | ) |
Returns the ID of the last record this Model inserted
- Returns:
- mixed public
Definition at line 1533 of file model_php4.php.
Referenced by AclNode::create().
| Model::getNumRows | ( | ) |
Returns the number of rows returned from the last query
- Returns:
- int public
Definition at line 1561 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::getNumRows | ( | ) |
Returns the number of rows returned from the last query
- Returns:
- int public
Definition at line 1560 of file model_php4.php.
References ConnectionManager::getDataSource().
| Model::hasAny | ( | $ | conditions = null |
) |
Returns true if a record that meets given conditions exists
- Parameters:
-
array $conditions SQL conditions array
- Returns:
- boolean True if such a record exists public
Definition at line 1130 of file model_php5.php.
| Model::hasAny | ( | $ | conditions = null |
) |
Returns true if a record that meets given conditions exists
- Parameters:
-
array $conditions SQL conditions array
- Returns:
- boolean True if such a record exists public
Definition at line 1129 of file model_php4.php.
| Model::hasField | ( | $ | name | ) |
Returns true if this Model has given field in its database table.
- Parameters:
-
string $name Name of field to look for
- Returns:
- boolean public
Definition at line 667 of file model_php5.php.
References $name, hasField(), and loadInfo().
| Model::hasField | ( | $ | name | ) |
Returns true if this Model has given field in its database table.
- Parameters:
-
string $name Name of field to look for
- Returns:
- boolean public
Definition at line 674 of file model_php4.php.
References $name, and loadInfo().
Referenced by hasField().
| Model::invalidate | ( | $ | field | ) |
Sets a field as invalid
- Parameters:
-
string $field The name of the field to invalidate
- Returns:
- void public
Definition at line 1412 of file model_php5.php.
| Model::invalidate | ( | $ | field | ) |
Sets a field as invalid
- Parameters:
-
string $field The name of the field to invalidate
- Returns:
- void public
Definition at line 1411 of file model_php4.php.
| Model::invalidFields | ( | $ | data = array() |
) |
Returns an array of invalid fields.
- Parameters:
-
array $data
- Returns:
- array Array of invalid fields or boolean case any error occurs public
Definition at line 1375 of file model_php5.php.
References $data.
| Model::invalidFields | ( | $ | data = array() |
) |
Returns an array of invalid fields.
- Parameters:
-
array $data
- Returns:
- array Array of invalid fields or boolean case any error occurs public
Definition at line 1374 of file model_php4.php.
References $data.
| Model::isForeignKey | ( | $ | field | ) |
Returns true if given field name is a foreign key in this Model.
- Parameters:
-
string $field Returns true if the input string ends in "_id"
- Returns:
- True if the field is a foreign key listed in the belongsTo array. public
Definition at line 1425 of file model_php5.php.
References $data.
| Model::isForeignKey | ( | $ | field | ) |
Returns true if given field name is a foreign key in this Model.
- Parameters:
-
string $field Returns true if the input string ends in "_id"
- Returns:
- True if the field is a foreign key listed in the belongsTo array. public
Definition at line 1424 of file model_php4.php.
References $data.
| Model::loadInfo | ( | ) |
Returns an array of table metadata (column names and types) from the database.
- Returns:
- array Array of table metadata public
Definition at line 607 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::loadInfo | ( | ) |
Returns an array of table metadata (column names and types) from the database.
- Returns:
- array Array of table metadata public
Definition at line 614 of file model_php4.php.
References ConnectionManager::getDataSource().
Referenced by getColumnType(), getColumnTypes(), hasField(), and setSource().
| Model::onError | ( | ) |
| Model::onError | ( | ) |
| Model::query | ( | ) |
Returns a resultset for given SQL statement. Generic SQL queries should be made with this method.
- Parameters:
-
string $sql SQL statement
- Returns:
- array Resultset public
Definition at line 1352 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::query | ( | ) |
Returns a resultset for given SQL statement. Generic SQL queries should be made with this method.
- Parameters:
-
string $sql SQL statement
- Returns:
- array Resultset public
Definition at line 1351 of file model_php4.php.
References ConnectionManager::getDataSource().
Referenced by Cache::clear(), AclNode::delete(), and Cache::remember().
| Model::read | ( | $ | fields = null, |
|
| $ | id = null | |||
| ) |
Returns a list of fields from the database
- Parameters:
-
mixed $id The ID of the record to read mixed $fields String of single fieldname, or an array of fieldnames.
- Returns:
- array Array of database fields public
Definition at line 719 of file model_php5.php.
References ConnectionManager::getDataSource().
| Model::read | ( | $ | fields = null, |
|
| $ | id = null | |||
| ) |
Returns a list of fields from the database
- Parameters:
-
mixed $id The ID of the record to read mixed $fields String of single fieldname, or an array of fieldnames.
- Returns:
- array Array of database fields public
Definition at line 726 of file model_php4.php.
References ConnectionManager::getDataSource().
| Model::remove | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
Synonym for del().
- Parameters:
-
mixed $id
- See also:
- function del
- Returns:
- boolean True on success public
Definition at line 987 of file model_php5.php.
| Model::remove | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
Synonym for del().
- Parameters:
-
mixed $id
- See also:
- function del
- Returns:
- boolean True on success public
Definition at line 986 of file model_php4.php.
| Model::save | ( | $ | data = null, |
|
| $ | validate = true, |
|||
| $ | fieldList = array() | |||
| ) |
Saves model data to the database. By default, validation occurs before save.
- Parameters:
-
array $data Data to save. boolean $validate If set, validation will be done before the save array $fieldList List of fields to allow to be written
- Returns:
- boolean success public
Definition at line 807 of file model_php5.php.
References $data, $v, and ConnectionManager::getDataSource().
| Model::save | ( | $ | data = null, |
|
| $ | validate = true, |
|||
| $ | fieldList = array() | |||
| ) |
Saves model data to the database. By default, validation occurs before save.
- Parameters:
-
array $data Data to save. boolean $validate If set, validation will be done before the save array $fieldList List of fields to allow to be written
- Returns:
- boolean success public
Definition at line 804 of file model_php4.php.
References $data, $v, and ConnectionManager::getDataSource().
Referenced by AclNode::create(), and AclNode::setParent().
| Model::saveField | ( | $ | name, | |
| $ | value, | |||
| $ | validate = false | |||
| ) |
Saves a single field to the database.
- Parameters:
-
string $name Name of the table field mixed $value Value of the field array $validate See $options param in Model::save(). Does not respect 'fieldList' key if passed
- Returns:
- boolean See Model::save() public
- See also:
- Model::save()
Definition at line 785 of file model_php5.php.
| Model::saveField | ( | $ | name, | |
| $ | value, | |||
| $ | validate = false | |||
| ) |
Saves a single field to the database.
- Parameters:
-
string $name Name of the table field mixed $value Value of the field boolean $validate Whether or not this model should validate before saving (defaults to false)
- Returns:
- boolean True on success save public
Definition at line 791 of file model_php4.php.
| Model::set | ( | $ | one, | |
| $ | two = null | |||
| ) |
This function does two things: 1) it scans the array $one for the primary key, and if that's found, it sets the current id to the value of $one[id]. For all other keys than 'id' the keys and values of $one are copied to the 'data' property of this object. 2) Returns an array with all of $one's keys and values. (Alternative indata: two strings, which are mangled to a one-item, two-dimensional array using $one for a key and $two as its value.)
- Parameters:
-
mixed $one Array or string of data string $two Value string for the alternative indata method
- Returns:
- array public
Definition at line 569 of file model_php5.php.
| Model::set | ( | $ | one, | |
| $ | two = null | |||
| ) |
This function does two things: 1) it scans the array $one for the primary key, and if that's found, it sets the current id to the value of $one[id]. For all other keys than 'id' the keys and values of $one are copied to the 'data' property of this object. 2) Returns an array with all of $one's keys and values. (Alternative indata: two strings, which are mangled to a one-item, two-dimensional array using $one for a key and $two as its value.)
- Parameters:
-
mixed $one Array or string of data string $two Value string for the alternative indata method
- Returns:
- array public
Definition at line 576 of file model_php4.php.
| Model::setDataSource | ( | $ | dataSource = null |
) |
Sets the DataSource to which this model is bound
- Parameters:
-
string $dataSource The name of the DataSource, as defined in Connections.php
- Returns:
- boolean True on success public
Definition at line 1582 of file model_php5.php.
References $dataSource, and ConnectionManager::getDataSource().
| Model::setDataSource | ( | $ | dataSource = null |
) |
Sets the DataSource to which this model is bound
- Parameters:
-
string $dataSource The name of the DataSource, as defined in Connections.php
- Returns:
- boolean True on success public
Definition at line 1581 of file model_php4.php.
References $dataSource, and ConnectionManager::getDataSource().
Referenced by setSource().
| Model::setId | ( | $ | id | ) |
| Model::setId | ( | $ | id | ) |
| Model::setInsertID | ( | $ | id | ) |
Sets the ID of the last record this Model inserted
- Parameters:
-
mixed $id
- Returns:
- void
Definition at line 1552 of file model_php5.php.
| Model::setInsertID | ( | $ | id | ) |
Sets the ID of the last record this Model inserted
- Parameters:
-
mixed $id
- Returns:
- void
Definition at line 1551 of file model_php4.php.
| Model::setSource | ( | $ | tableName | ) |
Sets a custom table for your controller class. Used by your controller to select a database table.
- Parameters:
-
string $tableName Name of the custom table public
Definition at line 537 of file model_php5.php.
References Object::cakeError(), ConnectionManager::getDataSource(), loadInfo(), and setDataSource().
| Model::setSource | ( | $ | tableName | ) |
Sets a custom table for your controller class. Used by your controller to select a database table.
- Parameters:
-
string $tableName Name of the custom table public
Definition at line 544 of file model_php4.php.
References Object::cakeError(), ConnectionManager::getDataSource(), loadInfo(), and setDataSource().
| Model::unbindModel | ( | $ | params | ) |
Turn off associations on the fly.
- Parameters:
-
array $params
- Returns:
- true public
Definition at line 398 of file model_php5.php.
| Model::unbindModel | ( | $ | params | ) |
Turn off associations on the fly.
- Parameters:
-
array $params
- Returns:
- true public
Definition at line 405 of file model_php4.php.
| Model::validates | ( | $ | data = array() |
) |
Returns true if all fields pass validation, otherwise false.
- Parameters:
-
array $data POST data
- Returns:
- boolean True if there are no errors public
Definition at line 1364 of file model_php5.php.
References $data.
| Model::validates | ( | $ | data = array() |
) |
Returns true if all fields pass validation, otherwise false.
- Parameters:
-
array $data POST data
- Returns:
- boolean True if there are no errors public
Definition at line 1363 of file model_php4.php.
References $data.
Member Data Documentation
| Model::$_tableInfo = null |
Definition at line 102 of file model_php4.php.
| Model::$alias = null |
| Model::$belongsTo = array() |
| Model::$cacheQueries = true |
| Model::$cacheSources = true |
Definition at line 234 of file model_php4.php.
| Model::$currentModel = null |
Definition at line 137 of file model_php4.php.
| Model::$data = array() |
| Model::$displayField = null |
Definition at line 66 of file model_php4.php.
| Model::$hasAndBelongsToMany = array() |
Definition at line 215 of file model_php4.php.
| Model::$hasMany = array() |
| Model::$hasOne = array() |
Definition at line 201 of file model_php4.php.
| Model::$id = false |
Reimplemented in Cache.
Definition at line 74 of file model_php4.php.
Referenced by AclNode::_resolveID(), AclNode::delete(), AclNode::getChildren(), AclNode::getParent(), AclNode::getPath(), and AclNode::setParent().
| Model::$keyToTable = array() |
Definition at line 158 of file model_php4.php.
| Model::$logTransactions = false |
Definition at line 172 of file model_php4.php.
| Model::$modelToTable = array() |
Definition at line 151 of file model_php4.php.
| Model::$name = null |
Reimplemented in Aco, AcoAction, Aro, and ArosAco.
Definition at line 130 of file model_php4.php.
Referenced by hasField().
| Model::$primaryKey = null |
Definition at line 95 of file model_php4.php.
| Model::$recursive = 1 |
Definition at line 222 of file model_php4.php.
| Model::$table = false |
| Model::$tablePrefix = null |
Definition at line 123 of file model_php4.php.
| Model::$tableToModel = array() |
Definition at line 144 of file model_php4.php.
| Model::$transactional = false |
Definition at line 179 of file model_php4.php.
| Model::$useDbConfig = 'default' |
| Model::$useTable = null |
| Model::$validate = array() |
Definition at line 110 of file model_php4.php.
| Model::$validationErrors = array() |
Definition at line 116 of file model_php4.php.
| Model::$whitelist = array() |
Definition at line 228 of file model_php4.php.
The documentation for this class was generated from the following files:
- 1.1.x.x/cake/libs/model/model_php4.php
- 1.1.x.x/cake/libs/model/model_php5.php