I am trying to access Coldbox getSetting
within a model.
In the docs, and on Coldbox Google Group posts, it clearly states
The model is a completely isolated layer of your application and has no access to anything ColdBox unless you inject dependencies into them. We suggest you look at our WireBox dependency injection so you can see how to inject the models with what they need.
They point to this doc: http://wiki.coldbox.org/wiki/WireBox.cfm#The_WireBox_Injector
But other than the somewhat confusing doc and Google Group posts repeating that quote above, there is no real good example on how to do it.
I have attempted property injection at the top of my model:
<cfcomponent displayname="myComponent" output="false">
<cfproperty name="mySetting" inject="coldbox:setting:mySetting" />
<cffunction name="myFunction" output="false" hint="index">
<cfset value = getProperty('mySetting') />
...
This returns Error Messages: Variable GETPROPERTY is undefined.
I also attempted an argument injection in the function of my model, but I knew that wouldn't work.
<cffunction name="myFunction" output="false" hint="index">
<cfargument name="mySetting" inject="coldbox:setting:mySetting">
Can anyone show me how to pass getSetting
to a model via wirebox injection, or really any method?
How do you inject a dependency in the model of Coldbox?