coldfusioncfc

How do I run a static method on a CFC without using cfinvoke?


How do I invoke a static method on a CFC without using cfinvoke? I know that I can do this:

<cfinvoke component="MyComponent" method="myStaticMethod' arg1="blah" returnvariable=myReturnVar>

I would like to be able to invoke this method the same way I would a UDF:

<cfset myReturnVar = MyComponent.myStaticMethod(blah)>

This, however, does not work. Is there syntax that I am messing up or is this just not possible?


Solution

  • not possible, since there's no "static method" in ColdFusion.

    The <cfinvoke> line in your question is the same as:

    myReturnVar = CreateObject("component", "MyComponent").myStaticMethod(arg1="blah");