Extracted at 2014-06-26.
pike.ida.liu.se
[Top]
Fins
Fins.Model
Fins.Model.DataObject

Class Fins.Model.DataObject

Description

This is an object that defines a Model-domain Data Mapping for a given table/data type. This class is singleton for a given data type. Use a DataObjectInstance object to retrieve data for a given data type.

The Fins model builder utility (pike -x fins model) will create the appropriate Pike module to contain the data mappings as well as any data mapping classes needed for a given database. The default mapping module for the "default" model definition is "Appname.DataMappings," for additional model definitions, the base module name is specified in the "definition_module" configuration attribute of the model definition. For example, if the model definition section specifies "ExternalDB" as the value of the "definition_module" attribute, the data mapping classes would be stored in the module "ExternalDB.DataMappings."

Models are configured by Fins.FinsModel , using either database reflection or by implementing the define method. By default, an object that inherits this class will automatically configure the mapping based on its name. For instance, a class named "User" will be configured from a table called "users" in the specified database. If this mapping were configured for the "default" model definition, this would be "Appname.DataMappings.User."


Constant SORT_ASCEND

constant Fins.Model.DataObject.SORT_ASCEND


Constant SORT_DESCEND

constant Fins.Model.DataObject.SORT_DESCEND


Variable default_sort_fields

array Fins.Model.DataObject.default_sort_fields

Description

an array with each element being an array with 2 elements: a field name and the sort order SORT_ASCEND or SORT_DESCEND . Note that any criteria provided to a find operation will override this setting.

Example

array default_sort_fields = ({ ({"name", SORT_DESCEND}) });


Variable primary_key

.Field Fins.Model.DataObject.primary_key


Variable alternate_key

.Field Fins.Model.DataObject.alternate_key


Variable repository

.Repository Fins.Model.DataObject.repository


mapping|Tools.Mapping.MappingCache Fins.Model.DataObject._objs
mapping|Tools.Mapping.MappingCache Fins.Model.DataObject._objs_by_alt


Variable fields

mapping(string:.Field) Fins.Model.DataObject.fields

Description

contains the list of field mappings. normally, this mapping should not be modified directly; use add_field instead.


Variable relationships

mapping Fins.Model.DataObject.relationships


Variable instance_name

string Fins.Model.DataObject.instance_name

Description

The name of this object; required if manually configuring. May be specified if auto-configuration is unable to predict the proper name.


Variable instance_name_plural

string Fins.Model.DataObject.instance_name_plural

Description

The plural name of this object; required if manually configuring. May be specified if auto-configuration is unable to predict the proper name. Used by scaffolding and for naming references to this object type from other object types.


Variable table_name

string Fins.Model.DataObject.table_name

Description

Somewhat self explanatory; mandatory if manually configuring, may be left blank if auto-configuring.


Variable field_order

array(string) Fins.Model.DataObject.field_order

Description

used by Fins.ScaffoldController to determine the order fields are displayed in generated forms.