dick
04/25/2022, 12:07 PMinit()
arguments?
I've tried this without success...
property name="test" inject="<http://path.to|path.to>.component( a='a', b='b')";
sknowlton
04/25/2022, 12:57 PMgetInstance( name = 'component', initArguments = { a = 'foo', b = 'bar' } );
sknowlton
04/25/2022, 12:57 PMWirebox.cfc
sknowlton
04/25/2022, 12:57 PMsknowlton
04/25/2022, 12:57 PMsknowlton
04/25/2022, 12:58 PMinject
anywayaliaspooryorik
dick
04/25/2022, 2:08 PMsingleton
so I guess they're transient.
I'd forgotten about getInstance()
and didn't know it took an initArguments
argument. Let me try that.
It looks neater that this which I get to work in the init()
of the receiving object
variables.test = createObject( "component", "path.to.component" ).init( a='a', b='b' );
sknowlton
04/25/2022, 2:10 PMcomponent
yet. onDIComplete()
is usually a safe place to put something like that - but if it's not a transient and not a singleton, having a single one stashed in your variables
scope seems ... not very transientsknowlton
04/25/2022, 2:10 PMaliaspooryorik
getInstance
in onDIComplete
is the easiest way to do it.dick
04/25/2022, 4:16 PMproperty _name_="wirebox" _inject_="wirebox";
in the pseudo constructor and
function onDIComplete() {
variables.test = wirebox.getInstance( "path.to.component", { a: 'a', b: 'b' } );
}