Application.cfc Issues
We are migrating a cf6 app to cf8 and I've run into an issue with the application.cfc. In my old application.cfm page the following code - in bold, creates a reference to an object, in the new cfc model this does not work.
old application.cfm page
<cffunction name="loadAppCFC" access="public" displayname="Load CFC module" hint="Load CFCs into the application scope">
<cfargument name="ObjectName" REQUIRED="Yes" TYPE="variableName">
<cfargument name="LocalName" type="variableName" default="#Arguments.ObjectName#">
<cfargument name="Reload" type="string" default="n">
<cfif Arguments.Reload eq "y" OR NOT IsDefined("Application.Obj.#Arguments.ObjectName#") OR ISDefined("Application.CFCReload.#Arguments.ObjectName#")>
<CFTRACE text="Reloading cfc object #Arguments.ObjectName# - #ISDefined('Application.CFCReload.#Arguments.ObjectName#')#">
<cflock timeout="5" throwontimeout="Yes" name="#Arguments.ObjectName#" type="EXCLUSIVE">
<cfobject name="Application.Obj.#Arguments.LocalName#" component="\ECConfig\Components\Lib\#Arguments.ObjectName#">
<CFIF IsDefined("Application.CFCReload")>
<cfset StructDelete(Application.CFCReload, Arguments.ObjectName, "True")>
</CFIF>
</cflock>
</cfif>
<cfset Variables[Arguments.LocalName] = evaluate("Application.Obj.#Arguments.LocalName#")>
</cffunction>
new application.cfc page
.
.function above is defined here
.
<cffunction name="onApplicationStart" returntype="boolean">
.
.
<cfset loadAppCFC("comUDF", "comUDF", Application.ini.debug.ReloadObjects)>
.
.
<cfreturn true/>
</cffunction>
</cfcomponent>
Using the old application page we can reference the object as comUDF.methodName, using the new application page this does not work and I have to instead use Application.Obj.comUDF.methodName. I am trying to avoid this as we have a very large number of pages that use these calls. If anyone can point out how I can create a reference to this object it would be greatly appreciated.
