Class Index | File Index

Classes


Class M.ModelAttribute


Extends M.Object.
M.ModelAttribute encapsulates all meta information about a model record's property: * is it required? * what data type is it of? (important for mapping to relational database schemas) * what validators shall be applied All M.ModelAttributes for a model record are saved under M.Model#__meta property of a model. Each ModelAttribute is saved with the record properties name as key. That means: model.record[propA] is the value of the property. model.__meta[propA] is the M.ModelAttribute object for the record property.
Defined in: model_attribute.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
The data type for the model record property.
 
Indicates whether this property is required to be set before persisting.
 
The type of this object.
 
Array containing all validators for this model record property.
Method Summary
Method Attributes Method Name and Description
<static>  
M.ModelAttribute.attr(dataType, opts)
Returns a model attribute.
 
validate(obj)
Iterates over validators array and calls validate on each validator with the param object passed to the validator.
Methods borrowed from class M.Object:
bindToCaller, create, destroy, extend, get, include, set
Class Detail
M.ModelAttribute()
Field Detail
{String} dataType
The data type for the model record property. Extremely important e.g. to map model to relational database table.

{Boolean} isRequired
Indicates whether this property is required to be set before persisting. If YES, then automatically @link M.PresenceValidator is added to the property, to check the presence.

{String} type
The type of this object.

{Object} validators
Array containing all validators for this model record property. E.g. [@link M.PresenceValidator, @link M.NumberValidator]
Method Detail
<static> {Object} M.ModelAttribute.attr(dataType, opts)
Returns a model attribute.
Parameters:
dataType
The data type of the attribute: e.g. String
opts
options for the attribute, such as defaultValue, isRequired flag, etc. ...
Returns:
{Object} M.ModelAttribute object

{Boolean} validate(obj)
Iterates over validators array and calls validate on each validator with the param object passed to the validator.
Parameters:
{Object} obj
The parameter object containing the model id, the record as M.ModelAttribute object and the value of the property.
Returns:
{Boolean} Indicates wheter the property is valid (YES|true) or invalid (NO|false).

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Dec 08 2010 15:07:32 GMT+0100 (MEZ)