I can’t seem to access any injected variables from within the “init” function. Is it possible?
e.g. the following will give me an error of “someSetting is undefined”.
`
if (someSetting eq "1")
super.init(entityName=“MyEntity1”, useQueryCaching=true, defaultAsQuery=false);
else {
super.init(entityName=“MyEntity2”, useQueryCaching=true, defaultAsQuery=false);
}
return this;
`
Sana
February 10, 2016, 12:48am
2
Hi Nick,
You can init any cfc with wirebox and can pass init-arguments
wirebox example
map(“anycfc”).to(“models.anycfc”).initArg(name=“someSetting”, dsl=“coldbox:setting:SomeSetting”)
OR
create new method onDIComplete() this will be executed after wirebox initialize the object. at this point you can access all properties injected by wirebox