Module with child modules. Inject parent settings

Hi guys,

I have a weird problem.

We have the following structure:

  • contentbox
  • MainParentModule
  • interceptors (MultiDomainSES.cfc)
  • modules
  • ChildModule

The main Module defines different setting for live and dev environments. eg:

function live(){ settings.isDevEnv = false; } function development(){settings.isDevEnv = true;`
}

`

The MultiDomainSES.cfc uses the setting “isDevEnv
property name=“isDevEnv” inject=“coldbox:setting:isDevEnv@MainParentModule”;

So for the case that we are on dev environment, we set different values with “setSESBaseURL()”

The child module uses event.buildlink(). We now had the case, that a link was created that pointed on the local dev url.
It seems, that a setting was not loaded correct. Then the injected value was empty and this caused a behavior like we just want to have on dev environment.

Is a order for loading the modules needed? Or any idea what happened?

Cheers
Andy

Depending on the interception point, is it getting fired before the sub module has been loaded yet? In ColdBox 4, you can specify dependencies for a module to be loaded first, but ContentBox is still on ColdBox 3.8 :-/

Instead of injecting the setting, try injecting WireBox and get the setting on the fly to see what that does?

wirebox.getInstance( dsl=“coldbox:setting:isDevEnv@MainParentModule” )

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com