Skip to content

Commit 34410de

Browse files
committed
Adding property definition for Model::$virtualFields
1 parent d561405 commit 34410de

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

cake/libs/model/model.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,20 @@ class Model extends Overloadable {
298298
*/
299299
var $order = null;
300300

301+
/**
302+
* Array of virtual fields this model has. Virtual fields are aliased
303+
* SQL expressions. Fields added to this property will be read as other fields in a model
304+
* but will not be saveable.
305+
*
306+
* `var $virtualFields = array('two' => '1 + 1');`
307+
*
308+
* Is a simplistic example of how to set virtualFields
309+
*
310+
* @var array
311+
* @access public
312+
*/
313+
var $virtualFields = array();
314+
301315
/**
302316
* Whether or not the model record exists, set by Model::exists().
303317
*
@@ -1057,8 +1071,8 @@ function isVirtualField($field) {
10571071
*
10581072
* @param mixed $name Name of field to look for
10591073
* @return mixed If $field is string expression bound to virtual field $field
1060-
* If $field is null, returns an array of all model virtual fields
1061-
* or false if none $field exist.
1074+
* If $field is null, returns an array of all model virtual fields
1075+
* or false if none $field exist.
10621076
* @access public
10631077
*/
10641078
function getVirtualField($field = null) {

0 commit comments

Comments
 (0)