[Coldbox-3.7.0] Passing Parameter for init by using getModel

Hi there,

I’ve found a crazy behavior when using the method “getModel()”.
There are three arguments (name, dsl, initArguments).
When i’m using the name-argument and also set some initArguments, this initArguments will be passed to the init-function of the target component.
But when I’m using the dsl-argument with the pattern I’ve added in the wirebox before, the initArguments will be lost.

Best
Matze

are you naming the parameters as you pass them in?

what happens when you dump ‘arguments’ in method?

initArgs is only used with a mapping ID. If you look at the code in the injector.getInstance() method you’ll see that if a DSL is passed in, the call is diverted to buildSimpleDSL() and the initArgs aren’t passed along. As to why it works this way, I’m not sure-- most DSL namespaces return singletons that are already created or bits of the framework that already have set initialization parameters.

Can you elaborate on your scenario-- what DSL are you using?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Hi Brad,

it’s a custom model I want to load.
The custom model is bind to thw wirebox. I also can use the name argument instead of the dsl argument, that works very well.

Thx and Best regards
Matze