cfm template updating cfc variable scope
Don't know if anybody's run into this before, but I ran into a strange issue with the variable scope in a cfc. Basically, I have some application settings stored in a database table, and then I have a cfc saved to application scope in which I store the contents of the table in a variable scope query. Within the cfc, I have a getter function that preforms a query of queries to pull the data I need. I then have an admin screen within the application to update the settings.
This is (very generally) what my cfc looks like:
<cfcomponent
name="settings.cfc">
<cffunction name="init" returntype="settings">
<cfset setAppSettings() />
<cfreturn this />
</cffunction>
<cffunction name="setAppSettings">
<cfquery name="variables.qrySettings" datasource="#application.dsn#">
SELECT *
FROM SETTINGS
</cfquery>
</cffunction>
<cffunction name="getAppSettings" returntype="query">
<cfargument name="id" />
<cfset var local = structNew() />
<cfquery name="local.qryResult" dbtype="query">
SELECT *
FROM variables.qrySettings
WHERE ID = <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_numeric" />
</cfquery>
<cfreturn local.qryResult />
</cffunction>
</cfcomponent>
In onApplicationStart in Application.cfc, I have this line:
<cfset
application.objSettings = createObject("component","settings").init() />
