Let's assume the following:
In my OnRequestStart-Handler, I'm doing the following:
<cfset var rc = Event.getCollection() />
<cfset rc.qGetSettings = instance.miscService.getSettings() />
This will store different settings in a query called rc.qGetSettings.
Now - in some methods of my models I have to get values out of this
rc.qGetSettings-Query, but I don't want to pass it as an argument
(because there can be situations where a model calls another model,
and then I have to pass and pass again).
I've started to store some values in session variables, but I'm not so
lucky with that way. What's the best practice to access the request
collection from within the model?
I did the following; my model looks like this:
<cfcomponent ...>
<cfproperty name="cbRequestService" inject="coldbox:requestService"
scope="instance"
<cffunction name="myMethod" access="public" returntype="void"
output="false"
<cfset var modelRC =
instance.cbRequestService.getContext().getCollection() />
<cfset var qMySettings = modelRC.qGetSettings />
</cffunction>
</cfcomponent>
=> Is this a good/"allowed" practice? Any performance/caching/other
issues to be expected? Any other ideas?