RE: [coldbox:11150] DI Question.

Are all three of these object transients? What scope do they live in?

If they are living in the request scope, you could ask wirebox for it via scope resolution possibly.

Alternatively, perhaps the policy object could supply the driver with a reference to the vehicle onDIComplete.

Or, you could look at whether or not you’re asking your driver object to “know” too much and maybe that logic should be elsewhere in a service who is familiar with all three objects.

Thanks!

~Brad

if I understand correctly, Brad’s proposal of using onDIComplete() may be the easiest solution.

Within your Policy object, create a onDIComplete() method that does something like:

function onDIComplete() {
variables.Driver.setVehicle(variables.Vehicle);
return;
}

Aaron Greenlee