Skip to content

Commit

Permalink
Adding property definition for Model::$virtualFields
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 20, 2009
1 parent d561405 commit 34410de
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cake/libs/model/model.php
Expand Up @@ -298,6 +298,20 @@ class Model extends Overloadable {
*/
var $order = null;

/**
* Array of virtual fields this model has. Virtual fields are aliased
* SQL expressions. Fields added to this property will be read as other fields in a model
* but will not be saveable.
*
* `var $virtualFields = array('two' => '1 + 1');`
*
* Is a simplistic example of how to set virtualFields
*
* @var array
* @access public
*/
var $virtualFields = array();

/**
* Whether or not the model record exists, set by Model::exists().
*
Expand Down Expand Up @@ -1057,8 +1071,8 @@ function isVirtualField($field) {
*
* @param mixed $name Name of field to look for
* @return mixed If $field is string expression bound to virtual field $field
* If $field is null, returns an array of all model virtual fields
* or false if none $field exist.
* If $field is null, returns an array of all model virtual fields
* or false if none $field exist.
* @access public
*/
function getVirtualField($field = null) {
Expand Down

0 comments on commit 34410de

Please sign in to comment.