[Wirebox] - Component name used as type for init arg

I’ve run into a problem in the past, where specifying a component’s name as an argument type can sometimes cause ACF to throw an invalid type exception during init. This was solved previously with an import statement at the top of the file to help ACF find the relevant class. However, this doesn’t seem to be working using Wirebox (not sure if it’s 1.7 or 1.8).

How does everyone else get around this?

//----BINDER MAPPING------------------------\

map(“SomeObject”).to(“path.to.SomeObject”);

map(“MyObject”).to(“another.path.to.MyObject”).initArg(name=“SomeObject”, ref=“SomeObject”);

//----CFC SAMPLE (MyObject)---------------\

import path.to.SomeObject;

component {

function init(
required SomeObject SomeObject
) {
return this;
}

}

I’m using ACF10.

Jason Durham

it sounds like someObject is not avaiable when myObject inits. can you verify that the object is init’d prior to myObject?

also, why not inject someObject using a cfproperty/dsl inside MyObject?

I’m delegating control of the creation of SomeObject to Wirebox as you can see in the binder snippet. If I change the argument type to “path.to.SomeObject” (instead of just “SomeObject”), I don’t get the exception during init.

As for your other question, it’s a matter of preference.

wont you need the notation path to the object for wirebox to find the cfc?

if its just “SomeObject”, the cfc would need to be in the root.

also, wirebox has the ability to scan folders.

The type parameter is being parsed and used by the CF engine, not by Wirebox.

Do you still get the error when creating the object manually?
If you remove the type and dump out the arguments inside the method and abort, is SomeObject being passed as you expected?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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