RE: [coldbox:18184] [coldbox 3.6.0] Question on Wirebox (getModel and getInstance)

Well, the getModel() method itself isn’t deprecated, but the original bean factory plugin is. You can still use the bean factory plugin for old times sake, but all it is now is a facade to Wirebox.

populateModel still exists in the frameworkSuperType (and therefore, all handlers, plugins, views, etc) and it delegates to the object populator in WireBox.
validateModel still exists in the frameworkSuperType (and therefore, all handlers, plugins, views, etc) and it delegates to the new validation manager in ColdBox.

Both of those methods are supported and safe to use.

If you’re not in a ColdBox-family CFC (ie, your models), you can wire in the object populator like so:

property name=“populator” inject=“wirebox:populator”;

and the validation manager like so:

property name=“validationManager” inject=“id:WireBoxValidationManager”;

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Any ideas what is wrong with this? I’m getting, Variable POPULATOR is undefined.

http://localhost/model/test.cfc?method=test

test.cfc is

component

{

property name=“populator” inject=“wirebox:populator”;

remote query function test(someVars)

{

LOCAL.bean=populator.getModel(“caseBean”);

writedump(LOCAL); //should give me an empty model?

abort;

}

}

When you call a CFC from the URL like that, it isn’t autowired. This is because the CF engine just creates a CFC instance directly and WireBox doesn’t have a way to intercept that.

ColdBox 4 does have a new feature though, where CFCs that extend the base proxy class will get autowired in the pseudo-constructor. Otherwise, you’d have to do something like application.wirebox.autowire( this ) in the CFC. Or, for that matter, application.wirebox.getInstance( ‘foo’ ).

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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