Model injection using CFProperty tag

Not sure if I have missed something, with the 3.x release of ColdBox.
However, I fought trying to get a model injected into some code using
the cfproperty tag, as follows:

<cfproperty name="CustomerService" type="Model" scope="instance" />

The model is stored in the file system as /model/CustomerService.cfc,
and there is an entry in the ModelMappings.cfm as below:

addModelMapping(alias="CustomerService",
path="model.CustomerService");

Simply put, the model did not get injected into the handler. I could
go a getModel("CustomerService") and that worked fine.

So, I dug and dug through documentation (I bought the ColdBox box),
and seemed to be doing everything right. After several hours, I did
come across a "footnote" on the ColdBox site that stated the
inject="Model" should be used instead of type="Model".

I changed the cfproperty tag to the following, and magically, it
started working.

<cfproperty name="CustomerService" inject="Model" scope="instance" />

Question: Have I got it right, that with version 3.x, type="Model" no
longer works? If that is the case, definitely recommend this be
highlighted on the site, as it took me a LONG time to discover.

Kevin Anderson
Superlative Solutions, Inc.

You did get it right

Yes, that is right, but for some reason I can’t get anything injected unless it’s in one of my Event Handlers. If I have another service layer CFC, it doesn’t seem to work for me.

If you are using the latest ColdBox 3 then you inject like this

property name=“ValidationService” inject=‘model’;

Regards,

Andrew Scott

http://www.andyscott.id.au/

That did change in CB 3 and its being noted for documentation. I
believe that the old code was supported up through Milestone 4 and
then starting with Milestone 5 the old code would no longer work. I
know that Luis is working on a lot of documentation revisions for CB 3
as it is a big release. There are some community tickets out there to
help with documentation and updating examples and what not. I'm going
to try and work on a couple this weekend and if anyone else has any
time, head on over to the Coldbox Community space on Assembla:
http://coldbox.assembla.com/wiki/show/coldbox-community

Cheers,
Judah

It is already well documented.

http://wiki.coldbox.org/wiki/Interceptors:Autowire.cfm

Regards,
Andrew Scott
http://www.andyscott.id.au/

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of Judah McAuley
Sent: Saturday, 25 September 2010 7:42 AM
To: coldbox@googlegroups.com
Subject: Re: [coldbox:5902] Model injection using CFProperty tag

That did change in CB 3 and its being noted for documentation. I believe

that

the old code was supported up through Milestone 4 and then starting with
Milestone 5 the old code would no longer work. I know that Luis is working
on a lot of documentation revisions for CB 3 as it is a big release. There

are

Yes, I meant putting a big section on "What's changed in CB 3.0" and a
prominent note on migrating 2.6 apps

Judah

+1 Vote for any moderator to make one of these threads sticky.

If you look here:
http://coldbox.assembla.com/spaces/coldbox/milestones/177987-3-0-0m6

You can see Luis mark’s tickets that break backward compatibility with a big (COMPATABILITY)

I can also see here has updated the wiki as well:
http://wiki.coldbox.org/wiki/Compatibility:3.0.0.cfm

Mark