I have been experimenting (a lot) with LW and auto wirining in my
model and did not get it to work. I saw a couple of threads were
people had the same problem - Injecting dependencies with FW from one
object in to another object in the model. I tried everything
cfproperty, <cfproperty name="User" type="model" scope="instance" />,
and also set up model maping, tried beanFactory: <cfproperty
name="beanFactory" type="coldbox:plugin:beanFactory" />, tested
autowiring Transfer with <cfproperty name="Transfer" type="ocm"
scope="instance"> and GetModel(), but as mentioned in the excellent
documentation this will only work in handlers, plugins etc, as I
understand it - not in the model. I have read everything a couple of
times and now I am rereading it again. Maybe it´s possible with
ColdSpring?
I want to have the advantage of object caching, autowiring and DI
otherwise I could just createObject() where I need it in my object by
composition.
For now I just have skiped the intercommunication between my objects
and instead use autowiring in my handlers and when I need a Transfer
object in one of my bussiness objects I instantiate them with getModel
() and pass in the Transfer objects in the constructor.
I had to re-think and refactor my BO:s but overall they tend to be
more low coupled, encapsulated - more OO-ish, i think is the right
word.