RE: Re: Re: Re: [coldbox:18105] [coldbox 3.5.3] referencing plugin in configure() in wirebox.cfc

Sorry, that’s not was I was asking. I wanted to see the actual code that called getUtilities() that you referenced two E-mails ago to help figure out the “Value must be initialized before use.” error you were receiving.

Have you also thought about not injecting at all, but for dependencies that might not exist (which at that point isn’t much of a “dependent”) injecting WireBox and asking it if the object exists, and if so retrieving it? Another option would be to use MockBox to create stubs for the non-existent objects, though I’m not entirely sure how your code is working around the dependencies that does exist in some cases since I assume your code still references them.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Here is the method. Very simple.

public struct function getSample(required any wrapper){
var metadata = arguments.wrapper.getEntityMetaData();

var requestPackage = getRequestPackage();

var result = [];

var writePath = arguments.wrapper.getWritePath(type=“sample”,fullName=metadata.fullName & “_LIST”);

requestPackage.setStatus(true);

for(var x=1;x<=5;x++){
arrayAppend(result,"#incrementEndpointID(wrapper=arguments.wrapper,by=X-1)#");
}

requestPackage.addDataset(name=“endpoints”,dataset=result);

fileWrite(writePath,getUtilities().indentXML(requestPackage.getPackage(“XML”)));

return {
format = “XML”,
description = “A XML sample response packet for a list of resources.”,
body = fileRead(writePath)
};
}

By design, cannot the binder inject plugins in configure() or is that a bug?

If I inject coldbox with iniArg(), I can then use getColdbox().getPlugin() in the class. Although, I would rather prefer a direct call to a plugin (or whatever else im injecting).