Inheritance diagram for Model:

Public Member Functions | |
| __collectForeignKeys ($type= 'belongsTo') | |
| __construct ($id=false, $table=null, $ds=null) | |
| __constructLinkedModel ($assoc, $className=null) | |
| __createLinks () | |
| __filterResults ($results, $primary=true) | |
| __generateAssociation ($type) | |
| __save ($data, $options) | |
| __saveMulti ($joined, $id) | |
| __sleep () | |
| __wakeup () | |
| _clearCache ($type=null) | |
| _deleteDependent ($id, $cascade) | |
| _deleteLinks ($id) | |
| _findCount ($state, $query, $results=array()) | |
| _findFirst ($state, $query, $results=array()) | |
| _findList ($state, $query, $results=array()) | |
| _findNeighbors ($state, $query, $results=array()) | |
| _findThreaded ($state, $query, $results=array()) | |
| _prepareUpdateFields ($data) | |
| afterDelete () | |
| afterFind ($results, $primary=false) | |
| afterSave ($created) | |
| beforeDelete ($cascade=true) | |
| beforeFind ($queryData) | |
| beforeSave ($options=array()) | |
| beforeValidate ($options=array()) | |
| bind ($model, $options=array(), $permanent=true) | |
| bindModel ($params, $reset=true) | |
| call__ ($method, $params) | |
| create ($data=array(), $filterKey=false) | |
| deconstruct ($field, $data) | |
| del ($id=null, $cascade=true) | |
| delete ($id=null, $cascade=true) | |
| deleteAll ($conditions, $cascade=true, $callbacks=false) | |
| escapeField ($field=null, $alias=null) | |
| exists ($reset=false) | |
| field ($name, $conditions=null, $order=null) | |
| find ($conditions=null, $fields=array(), $order=null, $recursive=null) | |
| findAll ($conditions=null, $fields=null, $order=null, $limit=null, $page=1, $recursive=null) | |
| findAllThreaded ($conditions=null, $fields=null, $order=null) | |
| findCount ($conditions=null, $recursive=0) | |
| findNeighbours ($conditions=null, $field, $value) | |
| getAffectedRows () | |
| getAssociated ($type=null) | |
| getColumnType ($column) | |
| getColumnTypes () | |
| & | getDataSource () |
| getDisplayField () | |
| getID ($list=0) | |
| getInsertID () | |
| getLastInsertID () | |
| getNumRows () | |
| hasAny ($conditions=null) | |
| hasField ($name) | |
| invalidate ($field, $value=true) | |
| invalidFields ($options=array()) | |
| isForeignKey ($field) | |
| isUnique ($fields, $or=true) | |
| joinModel ($assoc, $keys=array()) | |
| onError () | |
| query () | |
| read ($fields=null, $id=null) | |
| remove ($id=null, $cascade=true) | |
| resetAssociations () | |
| save ($data=null, $validate=true, $fieldList=array()) | |
| saveAll ($data=null, $options=array()) | |
| saveField ($name, $value, $validate=false) | |
| schema ($field=false) | |
| set ($one, $two=null) | |
| setDataSource ($dataSource=null) | |
| setInsertID ($id) | |
| setSource ($tableName) | |
| unbindModel ($params, $reset=true) | |
| updateAll ($fields, $conditions=true) | |
| updateCounterCache ($keys=array(), $created=false) | |
| validates ($options=array()) | |
Public Attributes | |
| $__affectedRows = null | |
| $__associationKeys | |
| $__associations = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany') | |
| $__backAssociation = array() | |
| $__exists = null | |
| $__insertID = null | |
| $__numRows = null | |
| $_findMethods | |
| $_schema = null | |
| $actsAs = null | |
| $alias = null | |
| $Behaviors = null | |
| $belongsTo = array() | |
| $cacheQueries = false | |
| $cacheSources = true | |
| $data = array() | |
| $displayField = null | |
| $findQueryType = null | |
| $hasAndBelongsToMany = array() | |
| $hasMany = array() | |
| $hasOne = array() | |
| $id = false | |
| $logTransactions = false | |
| $name = null | |
| $order = null | |
| $primaryKey = null | |
| $recursive = 1 | |
| $table = false | |
| $tablePrefix = null | |
| $tableToModel = array() | |
| $transactional = false | |
| $useDbConfig = 'default' | |
| $useTable = null | |
| $validate = array() | |
| $validationErrors = array() | |
| $whitelist = array() | |
Definition at line 43 of file model.php.
| Model::__construct | ( | $ | id = false, |
|
| $ | table = null, |
|||
| $ | ds = null | |||
| ) |
Constructor. Binds the model's database table to the object.
| integer | $id Set this ID for this model on startup | |
| string | $table Name of database table to use. | |
| object | $ds DataSource connection object. |
Definition at line 340 of file model.php.
References $alias, $id, $name, $table, __construct(), __createLinks(), ClassRegistry::addObject(), hasField(), Set::merge(), name(), setDataSource(), setSource(), and tableize().
| Model::__collectForeignKeys | ( | $ | type = 'belongsTo' |
) |
| Model::__constructLinkedModel | ( | $ | assoc, | |
| $ | className = null | |||
| ) |
Private helper method to create associated models of a given class.
| string | $assoc Association name | |
| string | $className Class name |
Definition at line 633 of file model.php.
References ClassRegistry::init(), and name().
Referenced by __createLinks(), __generateAssociation(), and bind().
| Model::__createLinks | ( | ) |
Create a set of associations.
Definition at line 573 of file model.php.
References __constructLinkedModel(), and __generateAssociation().
Referenced by __construct(), and bindModel().
| Model::__filterResults | ( | $ | results, | |
| $ | primary = true | |||
| ) |
Passes query results through model and behavior afterFilter() methods.
| array | Results to filter | |
| boolean | $primary If this is the primary model results (results from model where the find operation was performed) |
Definition at line 2231 of file model.php.
References afterFind().
Referenced by find().
| Model::__generateAssociation | ( | $ | type | ) |
Build an array-based association from string.
| string | $type 'belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany' |
Definition at line 657 of file model.php.
References $data, __constructLinkedModel(), camelize(), ClassRegistry::isKeySet(), name(), schema(), singularize(), and underscore().
Referenced by __createLinks(), and bind().
| Model::__save | ( | $ | data, | |
| $ | options | |||
| ) |
Private helper method used by saveAll.
Definition at line 1653 of file model.php.
References create(), save(), and validates().
Referenced by saveAll().
| Model::__saveMulti | ( | $ | joined, | |
| $ | id | |||
| ) |
Saves model hasAndBelongsToMany data to the database.
| array | $joined Data to save | |
| mixed | $id ID of record in this model private |
Definition at line 1295 of file model.php.
References $data, $id, Set::extract(), getColumnType(), ConnectionManager::getDataSource(), joinModel(), name(), and String::uuid().
Referenced by save().
| Model::__sleep | ( | ) |
| Model::__wakeup | ( | ) |
| Model::_clearCache | ( | $ | type = null |
) |
Private method. Clears cache for this model.
| string | $type If null this deletes cached views if Cache.check is true Will be used to allow deleting query cache also |
Definition at line 2816 of file model.php.
References clearCache(), pluralize(), Configure::read(), and underscore().
| Model::_deleteDependent | ( | $ | id, | |
| $ | cascade | |||
| ) |
Cascades model deletes through associated hasMany and hasOne child records.
| string | $id ID of record that was deleted | |
| boolean | $cascade Set to true to delete records that depend on this record |
Definition at line 1752 of file model.php.
References escapeField().
Referenced by del(), and deleteAll().
| Model::_deleteLinks | ( | $ | id | ) |
Cascades model deletes through HABTM join keys.
| string | $id ID of record that was deleted |
Definition at line 1791 of file model.php.
References escapeField(), and ConnectionManager::getDataSource().
Referenced by del(), and deleteAll().
| Model::_findCount | ( | $ | state, | |
| $ | query, | |||
| $ | results = array() | |||
| ) |
Handles the before/after filter logic for find('count') operations. Only called by Model::find().
| string | $state Either "before" or "after" | |
| array | $query | |
| array | $data |
Definition at line 2040 of file model.php.
References ConnectionManager::getDataSource().
| Model::_findFirst | ( | $ | state, | |
| $ | query, | |||
| $ | results = array() | |||
| ) |
Handles the before/after filter logic for find('first') operations. Only called by Model::find().
| string | $state Either "before" or "after" | |
| array | $query | |
| array | $data |
Definition at line 2016 of file model.php.
References escapeField().
| Model::_findList | ( | $ | state, | |
| $ | query, | |||
| $ | results = array() | |||
| ) |
Handles the before/after filter logic for find('list') operations. Only called by Model::find().
| string | $state Either "before" or "after" | |
| array | $query | |
| array | $data |
Definition at line 2071 of file model.php.
References Set::combine(), and String::tokenize().
| Model::_findNeighbors | ( | $ | state, | |
| $ | query, | |||
| $ | results = array() | |||
| ) |
| Model::_findThreaded | ( | $ | state, | |
| $ | query, | |||
| $ | results = array() | |||
| ) |
In the event of ambiguous results returned (multiple top level results, with different parent_ids) top level results with different parent_ids to the first result will be dropped
| mixed | $state | |
| mixed | $query | |
| array | $results |
Definition at line 2187 of file model.php.
References Set::extract().
| Model::_prepareUpdateFields | ( | $ | data | ) |
Helper method for Model::updateCounterCache(). Checks the fields to be updated for
| array | $data The fields of the record that will be updated |
Definition at line 1439 of file model.php.
Referenced by save().
| Model::afterDelete | ( | ) |
Called after every deletion operation.
public http://book.cakephp.org/view/686/afterDelete
Definition at line 2785 of file model.php.
Referenced by del().
| Model::afterFind | ( | $ | results, | |
| $ | primary = false | |||
| ) |
Called after each find operation. Can be used to modify any results returned by find(). Return value should be the (modified) results.
| mixed | $results The results of the find operation | |
| boolean | $primary Whether this model is being queried directly (vs. being queried as an association) |
Definition at line 2745 of file model.php.
Referenced by __filterResults().
| Model::afterSave | ( | $ | created | ) |
Called after each successful save operation.
| boolean | $created True if this save created a new record public http://book.cakephp.org/view/684/afterSave |
Definition at line 2766 of file model.php.
Referenced by save().
| Model::beforeDelete | ( | $ | cascade = true |
) |
Called before every deletion operation.
| boolean | $cascade If true records that depend on this record will also be deleted |
Definition at line 2776 of file model.php.
Referenced by del().
| Model::beforeFind | ( | $ | queryData | ) |
Called before each find operation. Return false if you want to halt the find call, otherwise return the (modified) query data.
| array | $queryData Data used to execute this query, i.e. conditions, order, etc. |
Definition at line 2732 of file model.php.
Referenced by find().
| Model::beforeSave | ( | $ | options = array() |
) |
Called before each save operation, after validation. Return a non-true result to halt the save.
Definition at line 2756 of file model.php.
Referenced by save().
| Model::beforeValidate | ( | $ | options = array() |
) |
Called during save operations, before validation. Please note that custom validation rules can be defined in $validate.
| $options | array Options passed from model::save(), see $options of model::save(). public http://book.cakephp.org/view/682/beforeValidate |
Definition at line 2796 of file model.php.
Referenced by invalidFields().
| Model::bind | ( | $ | model, | |
| $ | options = array(), |
|||
| $ | permanent = true | |||
| ) |
Bind model associations on the fly.
If $permanent is true, association will not be reset to the originals defined in the model.
| mixed | $model A model or association name (string) or set of binding options (indexed by model name type) | |
| array | $options If $model is a string, this is the list of association properties with which $model will be bound | |
| boolean | $permanent Set to true to make the binding permanent |
Definition at line 462 of file model.php.
References $name, __constructLinkedModel(), and __generateAssociation().
| Model::bindModel | ( | $ | params, | |
| $ | reset = true | |||
| ) |
Bind model associations on the fly.
If $reset is false, association will not be reset to the originals defined in the model
Example: Add a new hasOne binding to the Profile model not defined in the model source code: $this->User->bindModel( array('hasOne' => array('Profile')) );
| array | $params Set of bindings (indexed by binding type) | |
| boolean | $reset Set to false to make the binding permanent |
Definition at line 515 of file model.php.
References __createLinks().
| Model::call__ | ( | $ | method, | |
| $ | params | |||
| ) |
Handles custom method calls, like findBy<field> for DB models, and custom RPC calls for remote data sources.
| string | $method Name of method to call. | |
| array | $params Parameters for the method. |
Definition at line 434 of file model.php.
References ConnectionManager::getDataSource(), and resetAssociations().
| Model::create | ( | $ | data = array(), |
|
| $ | filterKey = false | |||
| ) |
Initializes the model for writing a new record, loading the default values for those fields that are not defined in $data. Especially helpful for saving data in loops.
| mixed | $data Optional data array to assign to the model after it is created. If null or false, schema data defaults are not merged. | |
| boolean | $filterKey If true, overwrites any primary key input with an empty value |
Definition at line 996 of file model.php.
References $data, Set::filter(), schema(), and set().
Referenced by __save(), invalidFields(), save(), and saveField().
| Model::deconstruct | ( | $ | field, | |
| $ | data | |||
| ) |
Deconstructs a complex data type (array or object) into a single field value.
| string | $field The name of the field to be deconstructed | |
| mixed | $data An array or object to be deconstructed into a field |
Definition at line 821 of file model.php.
References $data, am(), getColumnType(), and ConnectionManager::getDataSource().
Referenced by set().
| 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.
| mixed | $id ID of record to delete | |
| boolean | $cascade Set to true to delete records that depend on this record |
Definition at line 1699 of file model.php.
References $id, __collectForeignKeys(), _clearCache(), _deleteDependent(), _deleteLinks(), afterDelete(), beforeDelete(), exists(), find(), ConnectionManager::getDataSource(), id(), and updateCounterCache().
| Model::delete | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
| Model::deleteAll | ( | $ | conditions, | |
| $ | cascade = true, |
|||
| $ | callbacks = false | |||
| ) |
Deletes multiple model records based on a set of conditions.
| mixed | $conditions Conditions to match | |
| boolean | $cascade Set to true to delete records that depend on this record | |
| boolean | $callbacks Run callbacks (not being used) |
Definition at line 1817 of file model.php.
References _deleteDependent(), _deleteLinks(), Set::extract(), find(), ConnectionManager::getDataSource(), and id().
| Model::escapeField | ( | $ | field = null, |
|
| $ | alias = null | |||
| ) |
Escapes the field name and prepends the model name. Escaping is done according to the current database driver's rules.
| string | $field Field to escape (e.g: id) | |
| string | $alias Alias for the model (e.g: Post) |
Definition at line 2535 of file model.php.
References $alias, ConnectionManager::getDataSource(), and name().
Referenced by _deleteDependent(), _deleteLinks(), _findFirst(), and updateCounterCache().
| Model::exists | ( | $ | reset = false |
) |
| Model::field | ( | $ | name, | |
| $ | conditions = null, |
|||
| $ | order = null | |||
| ) |
Returns the contents of a single field given the supplied conditions, in the supplied order.
| string | $name Name of field to get | |
| array | $conditions SQL conditions (defaults to NULL) | |
| string | $order SQL ORDER BY fragment |
Definition at line 1060 of file model.php.
References $data, $name, $order, $recursive, and find().
Referenced by _findNeighbors(), findNeighbours(), getColumnTypes(), invalidFields(), and updateCounterCache().
| Model::find | ( | $ | conditions = null, |
|
| $ | fields = array(), |
|||
| $ | order = null, |
|||
| $ | recursive = null | |||
| ) |
Returns a result set array.
Also used to perform new-notation finds, where the first argument is type of find operation to perform (all / first / count / neighbors / list / threaded ), second parameter options for finding ( indexed array, including: 'conditions', 'limit', 'recursive', 'page', 'fields', 'offset', 'order')
Eg: find('all', array( 'conditions' => array('name' => 'Thomas Anderson'), 'fields' => array('name', 'email'), 'order' => 'field3 DESC', 'recursive' => 2, 'group' => 'type'));
Specifying 'fields' for new-notation 'list':
| array | $conditions SQL conditions array, or type of find operation (all / first / count / neighbors / list / threaded) | |
| mixed | $fields Either a single string of a field name, or an array of field names, or options for matching | |
| string | $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") | |
| integer | $recursive The number of levels deep to fetch associated records |
Definition at line 1935 of file model.php.
References __filterResults(), beforeFind(), ConnectionManager::getDataSource(), getID(), group(), offset(), and resetAssociations().
Referenced by _findNeighbors(), _prepareUpdateFields(), del(), deleteAll(), exists(), field(), findAll(), findAllThreaded(), findCount(), findNeighbours(), hasAny(), isUnique(), read(), and updateCounterCache().
| Model::findAll | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | order = null, |
|||
| $ | limit = null, |
|||
| $ | page = 1, |
|||
| $ | recursive = null | |||
| ) |
| Model::findAllThreaded | ( | $ | conditions = null, |
|
| $ | fields = null, |
|||
| $ | order = null | |||
| ) |
| Model::findCount | ( | $ | conditions = null, |
|
| $ | recursive = 0 | |||
| ) |
| Model::findNeighbours | ( | $ | conditions = null, |
|
| $ | field, | |||
| $ | value | |||
| ) |
| Model::getAffectedRows | ( | ) |
Returns the number of rows affected by the last query.
Definition at line 2623 of file model.php.
References ConnectionManager::getDataSource().
| Model::getAssociated | ( | $ | type = null |
) |
| Model::getColumnType | ( | $ | column | ) |
Returns the column type of a column in the model.
| string | $column The name of the model column |
Definition at line 938 of file model.php.
References ConnectionManager::getDataSource(), and schema().
Referenced by __saveMulti(), deconstruct(), and save().
| Model::getColumnTypes | ( | ) |
| & Model::getDataSource | ( | ) |
Gets the DataSource to which this model is bound. Not safe for use with some versions of PHP4, because this class is overloaded.
Definition at line 2662 of file model.php.
References ConnectionManager::getDataSource().
| Model::getDisplayField | ( | ) |
Returns the display field for this model.
| Model::getID | ( | $ | list = 0 |
) |
| Model::getInsertID | ( | ) |
Returns the ID of the last record this model inserted.
Definition at line 2595 of file model.php.
Referenced by getLastInsertID().
| Model::getLastInsertID | ( | ) |
Returns the ID of the last record this model inserted.
Definition at line 2586 of file model.php.
References getInsertID().
| Model::getNumRows | ( | ) |
Returns the number of rows returned from the last query.
Definition at line 2613 of file model.php.
References ConnectionManager::getDataSource().
| Model::hasAny | ( | $ | conditions = null |
) |
| Model::hasField | ( | $ | name | ) |
Returns true if the supplied field exists in the model's database table.
| mixed | $name Name of field to look for, or an array of names |
Definition at line 965 of file model.php.
References $name, and schema().
Referenced by __construct(), save(), and updateCounterCache().
| Model::invalidate | ( | $ | field, | |
| $ | value = true | |||
| ) |
Marks a field as invalid, optionally setting the name of validation rule (in case of multiple validation for field) that was broken.
| string | $field The name of the field to invalidate | |
| mixed | $value Name of validation rule that was not failed, or validation message to be returned. If no validation key is provided, defaults to true. public |
Definition at line 2495 of file model.php.
Referenced by invalidFields().
| Model::invalidFields | ( | $ | options = array() |
) |
Returns an array of fields that have failed validation.
| string | $options An optional array of custom options to be made available in the beforeValidate callback |
Definition at line 2344 of file model.php.
References $validate, $whitelist, __(), beforeValidate(), create(), Object::dispatchMethod(), exists(), false, field(), Validation::getInstance(), and invalidate().
Referenced by validates().
| Model::isForeignKey | ( | $ | field | ) |
| Model::isUnique | ( | $ | fields, | |
| $ | or = true | |||
| ) |
Returns false if any fields passed match any (by default, all if $or = false) of their matching values.
| array | $fields Field/value pairs to search (if no values specified, they are pulled from $this->data) | |
| boolean | $or If false, all fields specified must match in order for a false return value |
| Model::joinModel | ( | $ | assoc, | |
| $ | keys = array() | |||
| ) |
Gets the name and fields to be used by a join model. This allows specifying join fields in the association definition.
| object | $model The model to be joined | |
| mixed | $with The 'with' key of the model association | |
| array | $keys Any join keys which must be merged with the keys queried |
Definition at line 2713 of file model.php.
References __(), and schema().
Referenced by __saveMulti().
| Model::onError | ( | ) |
Called when a DataSource-level error occurs.
| Model::query | ( | ) |
Returns a resultset for a given SQL statement. Custom SQL queries should be performed with this method.
| string | $sql SQL statement |
Definition at line 2316 of file model.php.
References ConnectionManager::getDataSource().
| Model::read | ( | $ | fields = null, |
|
| $ | id = null | |||
| ) |
Returns a list of fields from the database, and sets the current model data (Model::$data) with the record found.
| mixed | $fields String of single fieldname, or an array of fieldnames. | |
| mixed | $id The ID of the record to read |
| Model::remove | ( | $ | id = null, |
|
| $ | cascade = true | |||
| ) |
| Model::resetAssociations | ( | ) |
| Model::save | ( | $ | data = null, |
|
| $ | validate = true, |
|||
| $ | fieldList = array() | |||
| ) |
Saves model data (based on white-list, if supplied) to the database. By default, validation occurs before save.
| array | $data Data to save. | |
| mixed | $validate Either a boolean, or an array. If a boolean, indicates whether or not to validate before saving. If an array, allows control of validate, callbacks, and fieldList | |
| array | $fieldList List of fields to allow to be written |
Definition at line 1124 of file model.php.
References $data, $validate, __saveMulti(), _clearCache(), _prepareUpdateFields(), afterSave(), beforeSave(), create(), exists(), getColumnType(), ConnectionManager::getDataSource(), hasField(), Set::merge(), set(), updateCounterCache(), String::uuid(), and validates().
Referenced by __save(), and saveField().
| Model::saveAll | ( | $ | data = null, |
|
| $ | options = array() | |||
| ) |
Saves multiple individual records for a single model; Also works with a single record, as well as all its associated records.
| array | $data Record data to save. This can be either a numerically-indexed array (for saving multiple records of the same type), or an array indexed by association name. | |
| array | $options Options to use when saving record data, which are as follows:
|
Definition at line 1478 of file model.php.
References $data, $validationErrors, __save(), getAssociated(), ConnectionManager::getDataSource(), id(), and Set::numeric().
| Model::saveField | ( | $ | name, | |
| $ | value, | |||
| $ | validate = false | |||
| ) |
Saves the value of a single field to the database, based on the current model ID.
| 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 |
Definition at line 1100 of file model.php.
References $id, $name, $validate, create(), id(), and save().
| Model::schema | ( | $ | field = false |
) |
Returns an array of table metadata (column names and types) from the database. $field => keys(type, null, default, key, length, extra)
| mixed | $field Set to true to reload schema, or a string to return a specific field |
Definition at line 895 of file model.php.
References ConnectionManager::getDataSource().
Referenced by __generateAssociation(), create(), getColumnType(), getColumnTypes(), hasField(), joinModel(), and setSource().
| 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.)
| mixed | $one Array or string of data | |
| string | $two Value string for the alternative indata method |
Definition at line 772 of file model.php.
References $data, deconstruct(), getAssociated(), and Set::reverse().
| Model::setDataSource | ( | $ | dataSource = null |
) |
Sets the DataSource to which this model is bound.
| string | $dataSource The name of the DataSource, as defined in app/config/database.php |
Definition at line 2634 of file model.php.
References Object::cakeError(), config(), and ConnectionManager::getDataSource().
Referenced by __construct(), and setSource().
| Model::setInsertID | ( | $ | id | ) |
| Model::setSource | ( | $ | tableName | ) |
Sets a custom table for your controller class. Used by your controller to select a database table.
| string | $tableName Name of the custom table |
Definition at line 740 of file model.php.
References Object::cakeError(), ConnectionManager::getDataSource(), schema(), and setDataSource().
Referenced by __construct().
| Model::unbindModel | ( | $ | params, | |
| $ | reset = true | |||
| ) |
Turn off associations on the fly.
If $reset is false, association will not be reset to the originals defined in the model
Example: Turn off the associated Model Support request, to temporarily lighten the User model: $this->User->unbindModel( array('hasMany' => array('Supportrequest')) );
| array | $params Set of bindings to unbind (indexed by binding type) | |
| boolean | $reset Set to false to make the unbinding permanent |
| Model::updateAll | ( | $ | fields, | |
| $ | conditions = true | |||
| ) |
Updates multiple model records based on a set of conditions.
| array | $fields Set of fields and values, indexed by fields. Fields are treated as SQL snippets, to insert literal values manually escape your data. | |
| mixed | $conditions Conditions to match, true for all records |
Definition at line 1673 of file model.php.
References ConnectionManager::getDataSource().
| Model::updateCounterCache | ( | $ | keys = array(), |
|
| $ | created = false | |||
| ) |
Updates the counter cache of belongsTo associations after a save or delete operation
| array | $keys Optional foreign key data, defaults to the information $this->data | |
| boolean | $created True if a new record was created, otherwise only associations with 'counterScope' defined get updated |
Definition at line 1384 of file model.php.
References $recursive, escapeField(), field(), find(), hasField(), and underscore().
| Model::validates | ( | $ | options = array() |
) |
Returns true if all fields pass validation.
| string | $options An optional array of custom options to be made available in the beforeValidate callback |
Definition at line 2329 of file model.php.
References invalidFields().
| Model::$__associationKeys |
Initial value:
array(
'belongsTo' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'counterCache'),
'hasOne' => array('className', 'foreignKey','conditions', 'fields','order', 'dependent'),
'hasMany' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery')
)
| Model::$__associations = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany') |
| Model::$_findMethods |
| Model::$actsAs = null |
| Model::$alias = null |
Definition at line 147 of file model.php.
Referenced by __construct(), escapeField(), and AclNode::node().
| Model::$belongsTo = array() |
| Model::$cacheQueries = false |
| Model::$data = array() |
Definition at line 83 of file model.php.
Referenced by __generateAssociation(), __saveMulti(), _prepareUpdateFields(), create(), deconstruct(), field(), save(), saveAll(), and set().
| Model::$hasAndBelongsToMany = array() |
| Model::$id = false |
Definition at line 75 of file model.php.
Referenced by __construct(), __saveMulti(), del(), read(), remove(), and saveField().
| Model::$name = null |
Reimplemented in Aco, AcoAction, Aro, and Permission.
Definition at line 140 of file model.php.
Referenced by __construct(), bind(), field(), hasField(), AclNode::node(), resetAssociations(), and saveField().
| Model::$recursive = 1 |
| Model::$table = false |
| Model::$useTable = null |
| Model::$validate = array() |
| Model::$validationErrors = array() |
| Model::$whitelist = array() |
1.4.7