1

I am not good with the terminology yet, so please forgive/correct me. Also I have no idea hw to use Coldspring, etc, so I am trying to just use wirebox.

I want to not use the beanFactory plugin and just call wirebox methods straight from my model.

Currently I can use this

<cfproperty name="bf" inject="coldbox:plugin:BeanFactory" scope="variables" />

How do I do it so that I can call wirebox's getInstance method instead of beanFactory's getModel?

Tyler Clendenin
  • 1,459
  • 1
  • 12
  • 25

2 Answers2

1

Within the handler, you can have Wirebox inject beans using property injection (much like what you posted).

Tag Based

<cfproperty name='myModel' inject='id:MyModel' />

Script Based

property name='myModel' inject='id:MyModel';

You can then use the model anywhere in the handler by simply calling myModel.someMethod().

It's also worth noting that if you are injecting using the model's ID, then the value of inject isn't required. Wirebox will attempt to look up the model using the name you gave it. You could simplify it.

Tag Based

<cfproperty name='myModel' inject />

Script Based

property name='myModel' inject;
Bryce
  • 11
  • 1
  • 2
0

I am not sure this is the answer you are looking for but...

In the handler you can do this.

var oMyModel = populateModel("myModel");

In a model you can do this.

var oMyModel = createobject("component", "myModel");

Does this answer what you need?

Leigh
  • 28,765
  • 10
  • 55
  • 103
Nathan Stanford
  • 1,336
  • 3
  • 23
  • 37