I will try to make this as short as possible. I have a component that looks like this:
<cfcomponent extends = "path.to.base" output = "false">
<cfproperty type="string" name="ID" />
<cfset variables.my = {} />
<cfset variables.my.ID = '' />
<cffunction access="public" returntype="path.to.component" name="init" output="false">
<cfargument required="false" type="string" name="ID" default="" />
<cfset setProperty( 'ID', arguments.ID ) />
<cfreturn this />
</cffunction>
</cfcomponent>
The setProperty() method exists in the extended 'path.to.base' component. It looks like this:
<cffunction access="public" returntype="boolean" name="setProperty" output="false">
<cfargument required="true" type="string" name="propertyName" />
<cfargument required="true" type="any" name="propertyValue" />
<cfset variables.my[ arguments.propertyName ] = arguments.propertyValue />
<cfreturn true />
</cffunction>
I am using an onMissingMethod() in my path.to.base component which allows me to call properties like myObj.ID() (and since the ID method does not exist, it checks if 'ID' exists in variables.my, and if so, returns it. So, I have code like this:
<cfset myObj = new path.to.component( '12345' ) />
<cfdump var="#myObj.ID()#" />
<cfset myObj.setProperty( 'ID', '54321' ) />
<cfdump var="#myObj.ID()#" />
<cfdump var="#myObj#" />
Line 2 outputs: '12345' (expected)
Line 4 outputs: '54321' (expected)
Line 5 dumps the object, and it has the methods exepcted, and a PROPERTIES substructure, with an ID key, but the value is empty.
So my question is "Why is ColdFusion not updating the respective Property, even though it is definitely updating in private variables.my keys?