getComponentStaticScope

Returns the static scope of a component — the variables shared by all instances of that CFC (variables declared with static in the component body). Accepts an instance of the component, a component template (the result of createObject), or a component name. Returns an empty struct when no static scope is available.

getComponentStaticScope(component) → returns struct

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

component any
Required

A component instance, a component template, or a dot-separated component name.

Examples
Sample code invoking the getComponentStaticScope function

Get the static variables of a component by name.

cfc = createObject("component", "models.Person");
statics = getComponentStaticScope(cfc);
writeDump(statics);

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub