This bug is killing me. I have a collection class for my companies plants. It creates a structure, the key of which is the plant number, and the value is the plant object for that particular plant. One of the methods is getPlantByNumber('01'), and it works fine- you pass the plant number in as an argument, and it returns the plant object for that number. I'd like to create another method, though, to return the entire collection, so you can loop through it on your own instead of having to call the getPlantByNumber over and over again (cfc method calls are expensive if you have hundreds of 'em). I can't do it. If I return the structure, I return a reference and the program I return it to can damage it. If I return a duplicate() of the structure, I encounter the bug. Either way, I'm hosed.
>When you duplicate an object it is converted from an object to a struct, and >any private variables the object had are lost. The following code >demonstrates the bug: > ><cfscript> > oServer = createObject("component","wgc.common.serverObject"); ></cfscript> > ><cfdump var=#oServer# label="oServer"> ><cfset a = oServer> ><cfdump var=#a# label="a"> ><cfset b = duplicate(a)> ><cfdump var=#b# label="b"> > >When b is dumped, the object is shown to be no longer an object, but a >struct. Duplicate() does not duplicate the object. > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4