Aliaspooryorik
ColdFusion ORM Book

Dynamic do Fusebox circuit.cfc style

I was just wondering if there is a difference between calling another fuseaction in a circuit.cfc using the two methods below:

Method 1:

Call another fuseaction in the same circuit using fusebox's dynamic do

<cfset myFusebox.do( action="list" ) />

Method 2:

Call another fuseaction function in the same cfc

<cfset List( myFusebox=myFusebox, event=event ) />

 It turns out that the first method will call the prefuseaction and postfuseaction before executing the "list" fuse, the second method won't.

Thanks to Sean Corfield and Barney Boisevert.


2 comments

  1. Useful post for those looking at the noXml version, I had just discovered that. My natural tendency was to use method 2, and hadn't done method 1 within my controller.

    Just wanted to add:
    Method 2 is a behaviour similar to that of a subroutine in mach-ii while leaving it as a handler also. It also makes it easier to use the postfuseaction() to call layouts if your fuseactions are making use of multiple methods in your controller.

    Comment by Matt – March 29, 2008
  2. Thanks for the comment Matt. That's a good point you make about calling layouts from the postfuseaction method.

    I have been using the postfuseaction method to call a super postfuseaction to handle layouts.

    For example in posts.cfc which extends layout.cfc I have the following postfuseaction:

      <cffunction name="postfuseaction" access="public" output="true" hint="I process post fuseaction execution">
        <cfargument name="myFusebox" />
        <cfargument name="event" />
        
        <cfset super.postfuseaction(myFusebox=myFusebox, event=event) />
      </cffunction>

    The postfuseaction method in layout.cfc then simply calls:

    <cfset myFusebox.do(action="vLayout.lay_clean") />

    Comment by John Whish – March 29, 2008

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.

Please subscribe me to any further comments
 

Search

Wish List

Found something helpful & want to say ’thanks‘? Then visit my Amazon Wish List :)

Categories

Recent Posts