My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
sosORM  
This is the doc page for the COOP radioButtonList tag.
Updated Nov 18, 2011 by sosensible


SoS > (sosORM)

sosORM

Description

This is the base class used to set some default features for ORM elements run inside of SOS.

Category

API

Methods

The following table lists methods for entities extended by the sosORM base class.

Populate

This method takes a structure and inserts it into the property values of the target entity.

Argument Description
populate This is the structure to be compared to the entity properties for updates.
propList This is an array of properties to be considered for insertion. If an item is not in this list it should not affect the entity properties. (This is not tested yet.)

entityObjectName.populate(ATTRIBUTES);

Save

This method stores the entity in the persistence data store.

Argument Description
n/a n/a

entityObjectName.save();

Example Code

example ORM entity class

component persistent="true" table="app__entityName"  output="false" extends="share.objects.sos.sosORM"
{
	/* properties */
	
	property name="entityName_id" column="entityName_id" type="numeric" ormtype="int" fieldtype="id" 
		generated="insert" generator="native" ;
	property name="entityName_main" column="entityName_main" ormType="string";
	
	property name="created_on" column="created_on" ormtype="timestamp" ; 
	property name="created_by" column="created_by" type="int" ormtype="int" default="0" ; 
	property name="updated_on" column="updated_on" ormtype="timestamp" ;
	property name="updated_by" column="updated_by" type="int" ormtype="int" default="0" ;

	/* relationships */
		
	
	/* Event Methods */
	public void function init(){
		// preset any collections here
	}
	
	public void function preInsert(){
		// remove these if you remove properties above
		var myNow = CreateODBCDateTime(now());
		var myUser = SESSION.user.get_id();
		setcreated_on(myNow);
		setcreated_by(myUser);
		setupdated_on(myNow);
		setupdated_by(myUser);
	}
	
	public void function preUpdate(){
		// remove these if you remove properties above
		var myNow = CreateODBCDateTime(now());
		var myUser = SESSION.user.get_id();
		setupdated_on(myNow);
		setupdated_by(myUser);
	}

}

Special Property Attributes For Entity Classes

Attributes Default Description
ignoreEmpty n/a This value if existing and set to true will make it so the value is deleted from the structure passed in and the entity properties are therefore not affected.
cleanseInput n/a If the field related to this item is a string and you would like the HTML to be escaped setting this attribute will do that for storage.


Sign in to add a comment
Powered by Google Project Hosting