Using argumentCollection with Super
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.
Thanks for the update. I thought I had gotten it to work once - it must have been on the site I have running CFMX 7.
Clearly, I ran into this problem on one of the many sites still running CFMX 6.1 and I should have tested and clarified the distinction.
Thanks for the note!
http://ray.camdenfamily.com/index.cfm/2005/10/27/C...
Yep, Brian already set me straight on this. Sorry for not doing my homework.
For anyone trying to follow the Sean's link to Ray's blog-entry, the software added a space in "CFMX" that shouldn't be there. I added the link to my blog to make life easier.
I am quickly becoming addicted to named arguments.