| By Steve Bryant | Article Rating: |
|
| January 9, 2006 03:45 PM EST | Reads: |
7,883 |
I recently had the need to use argumentcollection with super. Unfortunately, super can't be used with argumentCollection or with named arguments (which would allow me to loop through a structure and set arguments with cfinvokeargument).Fortunately, I found a solution in the comments of the ColdFusion LiveDocs. As pointed out by "eblackey" (on "Using inheritance and the Super keyword"), if you copy super to this.super, you can then reference methods of this.super using argumentCollection or named arguments.
Adding this line to the pseudo-constructor (anything within <cfcomponent>, but not inside any method - that is not in <cffunction>), will copy super to this.super.
<cfset this.super = super>
Then, when calling a method ("myMethod()" in this example) of super from a method in your component, you can do this to pass all of the arguments of your method to super.myMethod:
<cfset this.super.myMethod(argumentCollection=arguments)>
Note that you won't be able to call private methods from this.super. If you have a constructor that is called when you first instantiate a component (an init method, for example), you might consider copying super there instead of in the psuedo-constructor so that you only make the copy when the component is instantiated and not every time that it is called.
This workaround solved the problem for me. I just started using it, so I will post again if I run into any trouble with it.
Until then, good luck!
UPDATE
This problem exists in ColdFusion MX 6.1, but not 7. See the following link for a related bug in CFMX 7:
http://ray.camdenfamily.com/index.cfm/2005/10/27/CFMX-7-and-Super-Fixes
Thanks to Brian Kotek and Sean Corfield for correcting my oversight.
posted Monday, 9 January 2006
Published January 9, 2006 Reads 7,883
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Steve Bryant
Steve Bryant is the founder and CEO of Bryant Web Consulting LLC (www.bryantwebconsulting.com) and teaches ColdFusion at Breakaway Interactive (www.breakawayinteractive.com). He got his BA in philosophy at Oklahoma State University. Steve, one of the top ColdFusion developers in the country, still has no idea how that led to a career in Web development. Steve blogs at steve.coldfusionjournal.com as one of CFDJ's published bloggers.
![]() |
SYS-CON Belgium News Desk 01/09/06 04:51:22 PM EST | |||
I recently had the need to use argumentcollection with super. Unfortunately, super can't be used with argumentCollection or with named arguments (which would allow me to loop through a structure and set arguments with cfinvokeargument). Fortunately, I found a solution in the comments of the ColdFusion LiveDocs. As pointed out by 'eblackey' (on 'Using inheritance and the Super keyword'), if you copy super to this.super, you can then reference methods of this.super using argumentCollection or named arguments. |
||||
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Reader Sued
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Adobe Betas Target RIAs and Cloud Computing
- Adobe MAX 2009 Online
- Thinking of Flex in London
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe & Salesforce Cut Cloud Deal
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Is Microsoft as Free as Open Source?
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- Adobe Flex Developer Earns $100K in New York City
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF






































