In my next post, I promise we will get back to coding. But first, I just wanted to make a quick post about "Convention over Configuration" with the ColdBox Framework.
Last time I checked, this was unique to ColdBox, this may have changed for FuseBox though, but ColdBox does not use an XML file to define event handlers, plugins, interceptors, views or anything other than where the framework should look for these things. It is all done through conventions (or standards).
Handlers are stored in a specific place (the /handlers directory). Any CFC found in there that extends coldbox.system.eventhandler is examined for public methods, and any public methods found are automatically registered with the framework as an event handler.
The same is true for Plugins, Interceptors, Layouts and Views. Therefore, there is no need for the XML config file to define each of these items. The framework already knows where and how to find them.
Additionally, you can change the conventions if you like, by modifying the coldbox.xml file that we talked about yesterday.
So if you wanted to change the location of your handlers directory from /handlers to /myhandlers you could do it in lines 127-132 (approx) of the coldbox.xml file.
<!-- Custom Conventions : You can override the framework wide conventions of the locations of the needed objects -->
<!-- <pluginsLocation></pluginsLocation> -->
<!-- <layoutsLocation></layoutsLocation> -->
<!-- <viewsLocation></viewsLocation> -->
<!-- <eventAction></eventAction> -->
And you could do the same for plugins, layouts, views and event actions (whatever those are) simply by uncommenting the tags and entering the path you would like.