[coldbox-4.1.0] Accessing injected variables from VirtualEntityService's init function

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;


`

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

Thanks Sana, that works.