I have some common UDFs and CFCs that I'd like to make available to all my controllers. I'm using Model-Glue 3. I've thought of several ways of doing so:
- Create a base controller that has
<cfinclude>
's to the UDFs and instantiates the CFCs. All other controller inherit from this controller. - Convert all UDFs to CFCs and use
ColdSpring.xml
to make the CFCs into beans. Then make it available to the controller using thebeans
attribute inModelGlue.xml
. - Store the UDFs and CFCs in the helpers folder and access them using the helpers scope. However, this looks like it was intended to be used by a view rather than a controller.
- Create a global
onRequestStart
which will instantiate the CFCs and store them in theevent
object. Then the controllers will access the CFCs by grabbing them directly out of theevent
object.
My question is, what is the method used by most people to make a common set of UDFs and CFCs available to all controllers?