I have not tried this, but here is a question, is there a way to modify the application.cfc this variables from another component? Is there a way to reach them?
If not, we would have to pass the this reference somewhere in order to manipulate it at onApplicationStart once the interceptors have fired for the environment detection and put a reference on the RC maybe??
If the SessionFactory has already been created at this stage (which I would expect that it has), then I would think changing these values would probably not change anything.
It’s actually a weird topic - because so many of us are used to configuring aspects of our applications inside a framework, and the ORM configuration is done on the Application.cfc, which is far removed from that.
I’ve already stolen pieces of ColdBox within my Application.cfc, like this snippet in my onRequestStart:
if(isfwReinit())
{
ormReload();
//load import data
include "install/import.cfm";
}
But obviously I will want to do some other things in the actual setup of my Application.cfc request, i.e. have my dev settings of:
Ok guys, I have a proof of concept working. I was able to pass the application.cfc reference into the reloadchecks and the loading of coldbox, manipulate them in an interceptor and process.
So this is good news. However, here is the deal. The settings cannot be done via the normal environment control interceptor because basically it only fires once. As we all know, application.cfc get’s re-created in every request, so there is no persistence here.
Therefore, the solution would be to do a preProcess() interceptor that will manipulate the application.cfc settings before ANYTHING fires and make the call from the onRequest() method in Application.cfc
Here is what I also did. Registered a new custom interception point called: changeAppProperties
On my aplication.cfc onRequest() method after the reloadChecks() I did this:
Then my interceptor receives the cfapplication as a “cfapp” key in the intercept data, I then change according to my environment setting the environment interceptor set and voila!!
The question I have is - if you are editing the Application variables inside onRequest, are you able to actually influence how the ORM starts up, or does that have to be in the pseudo constructor?