I have to be doing something wrong, I just can't seem to get
autowiring to work in the Model. I keep getting the variable is
undefined in the scope.
I have the autowire interceptor enabled in the config file
here is the code snippets. (this is just a stripped down version)
----- config --------
<Datasources>
<Datasource alias="betaDb" name="betadb" dbtype="oracle"
username="" password="" />
</Datasources >
--------- Model --------
modeltest.cfc
<cfcomponent output="true" autowire="true">
<cfproperty name="dsn" type="coldbox:datasource:betaDb"
scope="instance"/>
<cfscript>
instance = structNew();
</cfscript>
<cffunction name="init" returntype="any" >
<cfreturn this >
</cffunction>
<cffunction name="testDSN" >
<cfset dsnName = instance.dsn.getName() />
<cfreturn dsnName />
</cffunction>
------ Handler ------
<cfcomponent name="profile" extends="coldbox.system.eventhandler"
output="false" >
<cffunction name="doTest" access="public" returntype="any"
output="true">
<cfargument name="Event" type="coldbox.system.beans.requestContext">
<cfscript>
var objData = CreateObject("component", "model.modeltest").init();
checktest = objData.testDSN();
</cfscript>
<cfdump var="#checktest#">
<cfabort>
</cffunction>
Thanks
Kevin