Title: RE: exposing model functions as 'remote'
Thread: exposing model functions as 'remote'
Forum: Need Help?
Conference: ColdBox
User: lmajano Hi,
I will be in the coming weeks posting more code on how to tap into the
proxy and model. Below is a simple example, again this is using the 2.6.0 Alpha
on SVN (Beta very very soon). You can also check the examples on SVN for a
couple of techniques.
The following example will create a new component based
on the proxy, with one method: 'getZipCodes' that will be taken off my model
object via ColdSpring.
[code]
<cfcomponent name="zipcodes" output="False"
extends="coldbox.system.extras.ColdboxProxy">
<cffunction
name="getZipCodes" access="Remote" returntype="query" output="false">
<cfscript>
var qZipCodes = "";
qZipCodes =
getBean("zipcodeService").getZipCodes();
return qZipCodes;
</cfscript>
</cffunction>
</cfcomponent>
[/code]
That's it. I used the method
"getBean()" which is using the loaded coldspring factory or lightwire, asks for
the [b]zipcodeService[/b] and executes a method on it. Then returns the results.
Hope this helps. THis is a sample of going directly to the model
http://forums.coldboxframework.com/index.cfm?event=ehMessages.dspMessages&threadid=1BFF10DE-FF65-CEF6-6536483BBA645106