I added a couple functions to help me understand the state of an
event. I know you could 'dump' the GetAll() but in my case I was
setting a value in a controller like, event.SetValue('loginResult',
event.GetState()._ToString()); to find the value I needed to call to
get the username, since 'username' wasn't returning a value.
To EventContext.cfc
<cffunction name="getState"
access="public"
returnType="ModelGlue.gesture.collections.MapCollection"
output="false"
hint="I get all values by reference.">
<cfreturn variables._state />
</cffunction>
To MapCollection.cfc
<cffunction name="_ToString" access="public" returntype="string"
output="false" hint="I return a string mapping of all the pairs">
<cfargument name="struct" type="struct" required="false"
default="#variables.values#" hint="I am the struct to string." />
<cfset var result="{">
<cfset var first = true>
<cfset var i = "">
<cfloop collection="#arguments.struct#" item="i">
<cfif not first><cfset result = result & ", "></cfif>
<cfif IsSimpleValue( arguments.struct[i] )>
<cfset result = result & "[#i#:#arguments.struct[i]#]">
<cfelseif IsStruct( arguments.struct[i] )>
<cfset result = result & "[#i#:" & this._ToString
( arguments.struct[i] ) & "]">
<cfelse>
<cfset result = result & "[#i#:(unknown type)]">
</cfif>
<!---<cfset result = result & "\n">--->
<cfset first = false>
</cfloop>
<cfset result = result & "}">
<cfreturn result>
</cffunction>
I didn't know how to get the MapCollection another way without
creating the additional function in EventContext
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en