What you want is a serialized form of your CFC. You need to write a
method, perhaps called serialization, or maybe toStruct(), that
returns a struct containing the data you want.


On Tue, Oct 5, 2010 at 4:12 PM, Tony Bentley
<[email protected]> wrote:
>
> I have a cfc that gets instantiated and then stored in an array. I have a 
> bunch of different objects (arrays, queries, structures, etc) in the cfc 
> which all gets used but because of the way I am storing them, the methods can 
> be called and I want to prevent that.
>
> So here is an example of my issue:
>
> Animal.cfc
>
> Cat.cfc extends Animal.cfc
>
> Cat.cfc:
>
> this.name="Kitty";
> //instance vars go here
> function init(id){
> this.id=arguments.id
> //setters go here
> return this;
> }
> function meow(){
> writeoutput("meow");
> }
>
> So now I am going to store the cats
> catsArray = [];
> for(i=1;i lte cats.recordcount;i++){
>   cat = createobject("component","cat.cfc").init(cats.id[i]);
>  //method to get structure here?
>   catsArray[i] = cat;
> }
>
> Now if you dump the array, you get all of the stuff in cat and animal but you 
> also get the methods to kill cat, feed cat and all. There must be a way to 
> only get the structure with members and not the option to call the cfc 
> methods.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337878
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to