Quantcast
Channel: Adobe Community : Discussion List - ColdFusion
Viewing all articles
Browse latest Browse all 6243

"setter" methods not working in CF11

$
0
0

I recently migrate code from a CF8.01 instance to a freshly installed/updated CF11 instance. As I was going through some testing I ran into an issue where the "setter" methods within a CFC are not setting the values of the locally scoped instance data within the CFC. The exact same code works on CF8. I read a couple articles which made reference to a new attribute of the cfcomponent tag (accessors=true) that will implicitly create getters/setters. I am not using this attribute so I'm not sure if that has anything to do with it. Below is some sample code.

 

test.cfm:

<cfscript>

   myObj = CreateObject('component', 'WorkUpBean').init();

   myObj.setTypeID(2);

</cfscript>

 

<cfdump var = "#myObj.getTypeID()#">

 

 

WorkUpBean.cfc:

<cfcomponent name="WorkUpBean" displayname="WorkUpBean" hint="I am a workup bean">

 

<cfscript>

  local = StructNew();

  local.TYPE_ID = 0;

</cfscript>

 

<cffunction  name="init" access="public" output="false" returntype="WorkUpBean">

   <cfargument name="TYPE_ID"   required="false" type="numeric" default="#local.TYPE_ID#" />

 

   <cfset setTypeID(Arguments.type_id)>

</cffunction>

 

<cffunction name="getTypeID" access="public" output="false" returntype="numeric">
   <cfreturn local.TYPE_ID />
</cffunction>

 

<cffunction name="setTypeID" access="public" output="false" returntype="void">
   <cfargument name="TYPE_ID" type="numeric" required="true" />
   <cfset local.TYPE_ID = arguments.TYPE_ID />
   <cfreturn />
</cffunction>

 

</cfcomponent>

 

 

I am at my wits end here. I need this working like yesterday! Any help would be greatly appreciated.


Viewing all articles
Browse latest Browse all 6243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>