Re: Dump out CFC properties/variables
I usually include a dump method in my CFC's that simply cfdumps out whatever internals you want to see and cfaborts. If all your CFCs extend a single base component, this is even easier since you can put the method there. ~Brad - Original Message - From: Scott Brady dsbr...@gmail.com To: cf-talk cf-talk@houseoffusion.com Sent: Saturday, June 26, 2010 9:17 PM Subject: Dump out CFC properties/variables What's a good way to dump out the properties/instance variables of a CFC? I have a page where I can pass in a variable name and dumping it out dynamically. But, with CFCs, obviously all I get are method names, which aren't that useful, when, in the case of beans, I want the values of the variables in the CFC (basically, the result of every getter). Typically, these beans are in the session scope. It seems like it shouldn't be that hard, but I'm not having much luck. ~| 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:334872 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Dump out CFC properties/variables
If all your CFCs extend a single base component, this is even easier since you can put the method there. And, of course, all your CFCs do extend a single base component by default - component.cfc. You can add a dump method to that on your dev server, if you only need to dump in your dev environment. I'm not sure I think this is the best approach, but it is certainly convenient, especially if you have an existing codebase of CFCs that don't have parents or dump methods, etc. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| 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:334873 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Dump out CFC properties/variables
We actually have a dump() method in our base component, but that has caused us problems in our onError method. (which I think I just figured out). Maybe the real question is ... if I have a variable name, how do I determine if it's a CFC? Or, more accurately, is there a way that, given a variable name, to determine what type of object it is? Scott On Sun, Jun 27, 2010 at 12:05 AM, Brad Wood b...@bradwood.com wrote: I usually include a dump method in my CFC's that simply cfdumps out whatever internals you want to see and cfaborts. If all your CFCs extend a single base component, this is even easier since you can put the method there. ~Brad -- - Scott Brady http://www.scottbrady.net/ ~| 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:334874 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Dump out CFC properties/variables
Actually, I guess there is an isObject() method (which I could have sworn wasn't in the docs when I looked last night :) ) which I could use. On Sun, Jun 27, 2010 at 5:30 AM, Scott Brady dsbr...@gmail.com wrote: We actually have a dump() method in our base component, but that has caused us problems in our onError method. (which I think I just figured out). Maybe the real question is ... if I have a variable name, how do I determine if it's a CFC? Or, more accurately, is there a way that, given a variable name, to determine what type of object it is? Scott On Sun, Jun 27, 2010 at 12:05 AM, Brad Wood b...@bradwood.com wrote: I usually include a dump method in my CFC's that simply cfdumps out whatever internals you want to see and cfaborts. If all your CFCs extend a single base component, this is even easier since you can put the method there. ~Brad -- - Scott Brady http://www.scottbrady.net/ -- - Scott Brady http://www.scottbrady.net/ ~| 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:334875 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Dump out CFC properties/variables
What's a good way to dump out the properties/instance variables of a CFC? I have a page where I can pass in a variable name and dumping it out dynamically. But, with CFCs, obviously all I get are method names, which aren't that useful, when, in the case of beans, I want the values of the variables in the CFC (basically, the result of every getter). Typically, these beans are in the session scope. It seems like it shouldn't be that hard, but I'm not having much luck. Scott -- - Scott Brady http://www.scottbrady.net/ ~| 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:334867 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm