Hello
I am having a problem, i know that in order to get a setting into my model, i have to wirebox dependancy inject for it, but i cannot find a good example on how to, can anyone show me how to pass getSetting to a model via wirebox injection?
Hello
I am having a problem, i know that in order to get a setting into my model, i have to wirebox dependancy inject for it, but i cannot find a good example on how to, can anyone show me how to pass getSetting to a model via wirebox injection?
A good place to start is always the WireBox documentation. Check out the “coldbox” injection namespace:
http://wiki.coldbox.org/wiki/WireBox.cfm#ColdBox_Namespace
It should look something like this:
property name=“mysetting” inject=“coldbox:setting:mysetting”;
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
I just saw your post on Stack Overflow which had much more information so I replied there. For the sake of readers here, injected properties are accessed via the “variables” scope by default, there is no special method needed to access them.
So it’s just #variables.mySetting#
not
#getProperty(“mySetting”)#
getProperty() is a special method that only applies in the binder config to access framework settings, not in your actual models.
This ref card may be a bit simpler to read through than the full docs, but it obviously doesn’t cover as much information:
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com