Consider the following mapping:
Now, try to create that model and pass in init args:
Foo never gets passed into myModel. Look in the injector.buildInstance() method and you'll see that initArguments are passed along for mappings of type CFC, webservice, and factory, but they are discarded for mappings of type DSL even though "model" is a DSL namespace that would use it (and for that matter, probably the Java namespace as well).
Fix injector.buildInstance() to pass along init args to the builder, and have the builder pass it around and use it for ID, model, and Java.
Is there a reason why this one won't be done? I just ran into this problem where I couldn't use the model's DSL and had to use the CFC path in order to pass the initArguments. I'd prefer not to be tied down to have to use the CFC path. Thoughts?
This might have been resolved in my rampage to close down issues. If you feel this is doable, then yes we can reopen
Re-opening this so we can consider it for ColdBox 6.
I have investigated this and it is not as easy as it sounds. I can pass the init arguments, the problem is WHEN to use them. Most of the DSL executions are getting values from pre-existing factories or objects or settings. There is NOWHERE for me to send those init arguments into? I would not know to where to send them.
Look at the buildDSLDependency() it has the wy to process the DSLs. Who get’s it there?
I have investigated this and it is not as easy as it sounds.
I never said it was easy. I always knew this would be a bit of a pain
There is NOWHERE for me to send those init arguments into? I would not know to where to send them.
Obviously, the interfaces for the builders would all need changed to pass the DSL and an optional collection of init args. And of course, not all the namespaces would even use the init args. It would only apply only to DSLs that created a model.
Look at the buildDSLDependency() it has the wy to process the DSLs. Who get’s it there?
For starters, getModelDSL() would get it. Also getProviderDSL() perhaps. I would recommend storing the prepared init args (when they existed) in the dsl struct that gets passed around. That way, it would have a minimal affect of method signature since that struct already defines all the information of the DSL to be created.