Note: Parameter $id was added in 2.1. Prior to that it does not take any parameter.
$this->Example->id = 9;
if ($this->Example->exists()) {
// ...
}
$exists = $this->Foo->exists(2);
Model::getAffectedRows()
Returns the number of rows affected by the last query.
Model::getAssociated(string $type = null)
Gets all the models with which this model is associated.
Model::getColumnType(string $column)
Returns the column type of a column in the model.
Model::getColumnTypes()
Returns an associative array of field names and column types.
Model::getID(integer $list = 0)
Returns the current record’s ID.
Model::getInsertID()
Returns the ID of the last record this model inserted.
Model::getLastInsertID()
Alias to getInsertID().
Virtual fields
Virtual fields allow you to create arbitrary SQL expressions and assign them as fields in a Model. These
fields cannot be saved, but will be treated like other model fields for read operations. They will be indexed
under the model’s key alongside other model fields.