blogs
Reactor - Using the field tag to to alias duplicate columns
Submitted by Doug Sims on Wed, 2006-07-19 15:55. coldfusion | reactorIt is mentioned in the Reactor docs that the <field> tag can be used within your object definitions to pretty up ugly column names such as txt_lastname or strCity, but it should also be noted it can be used to diferentiate between two tables which both have fields with the same name.
for example, if all my tables have a modified date timestamp
<object name="User">
<field name="ModifiedDate" alias="UserModifiedDate" />
<hasMany name="Task">
<relate from="Taskid" to="Taskid" />
</hasMany>
</object>
<object name="Task">
<field name="ModifiedDate" alias="TaskModifiedDate" />
<hasOne name="User">
<relate from="UserId" to="UserId" />
</hasOne>
</object>Then, when I am doing a join later, I can reference the modified dates correctly.
Organizing ModelGlue Events
Submitted by Doug Sims on Tue, 2006-07-18 21:31. coldfusion | modelglueThis may be old news, but did everyone know you can include ModelGlue.xml file within your main modelglue.xml files. The framework has provided an tag within the modelglue config file. you can include as many XML files as you need as long as they are formatted correctly.
The include tag goes after the opening <modelglue> tag and before the first <controller> tag
then you can group the event handlers into multiple files to keep them organized in a logical way.
example:
<modelglue>
<include template="/config/UserEvents.xml" />
<include template="/config/AdminEvents.xml" />
<controllers>Chaining ModelGlue Generic Commit Events
Submitted by Doug Sims on Fri, 2006-07-14 19:42. coldfusion | generic database messages | modelglueI have really been loving the generic ORM stuff that is part of ModelGlue 2.0. I had been doing way to much work to stuff the objects we needed into the viewstate. Now I have been able to remove countless listeners and broadcasts I was using to get various objects when needed.
Now a generic read takes care of that.
The basic functionality of the generic events are documented at http://docs.model-glue.com so I wont get into how to use them, but one thing that isn't documented is how to handle updates to multiple unrelated objects in the same form post( event-handler)
Here is how I am doing it, It works like a charm for quick prototyping,as far as I am concerned.
Lets say I have 2 objects, Cinders and Ashes. I am collecting this data on the same form and I need to handle the validation and update the results. I need two generic commit message broadcasts
<message name="modelglue.GenericCommit">
<argument name="object" value="Cinder" />
<argument name="CinderId" value="Cinder" />
</message>and
<message name="modelglue.GenericCommit">
<argument name="object" value="Ashes" />
<argument name="AshesId" value="Ashes" />
</message>My form lives at an event called "CindersAndAshes.form" and submits to an event called


delicious
digg
reddit
technorati