Model Injection Not Working

36 views
Skip to first unread message

namtax

unread,
Dec 11, 2009, 6:56:32 AM12/11/09
to ColdBox Platform
Hi there

Wondering if I could get some assistance on an issue..

I am trying to implement Coldbox with CF9, so am following the task
manager demo.

I am using coldbox version 2.6.4

I have set up tasks, and taskService cfcs in the model folder, the
same as in the demo...

I then have the following code in my task handler

component extends="coldbox.system.EventHandler" output="false"{
property name="TaskService" inject;


void function save(event) output=false{
var rc = event.getCollection();
rc.task = TaskService.getTask(event.getValue("taskID", ""));
populateModel(rc.task);
taskService.save(rc.task);

flash.put("message","Task saved sucessfully!");

setNextEvent('tasks');
}
}

However, when I call the "task.save", i am getting the error message
taskService is undefined. Im wondering if there is some settings i
need to change to allow the injection of the model object, or if I am
doing something wrong.

Many thanks

Doug Boude

unread,
Dec 11, 2009, 7:09:15 AM12/11/09
to col...@googlegroups.com
Just out of curiosity, in your coldbox.xml.cfm, do you have the autowire interceptor enabled?

<!-- USE AUTOWIRING -->
<Interceptor class="coldbox.system.interceptors.autowire">
<Property name='enableSetterInjection'>true</Property>
</Interceptor>

For v 2.6.4 you do have to explicitly enable it.

Doug :0)


--
You received this message because you are subscribed to the Google Groups "ColdBox: A ColdFusion Framework" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For more information, visit http://www.luismajano.com/projects/coldbox
For Documentation, visit http://ortus.svnrepository.com/coldbox/trac.cgi

John Whish

unread,
Dec 11, 2009, 7:15:59 AM12/11/09
to col...@googlegroups.com
I'm pretty sure the in 2.6.4 you can't us:

property name="TaskService" inject;

Try:

property name="TaskService" type="model:TaskService" scope="variables";

and see if that works

Sana

unread,
Dec 11, 2009, 8:08:23 AM12/11/09
to ColdBox Platform
Hi,

I would second as John Whish mentioned.

But I would be suggest to use coldbox v3.0 beta3 or SVN code-base.
In coldbox 3.0 new syntax works ( property name="TaskService"
inject; )

Thanks
Sana

namtax

unread,
Dec 11, 2009, 11:05:37 AM12/11/09
to ColdBox Platform
Hi there

property name="TaskService" type="model:TaskService"
scope="variables";

Doesnt seem to be working, and when i install coldbox 3 I am recieving
the error message

Could not find the ColdFusion component or interface C:
\ColdFusion9\wwwroot\Coldbox\system\beans\requestContext.cfc.

Thanks

Thanks

Luis Majano

unread,
Dec 11, 2009, 1:16:48 PM12/11/09
to col...@googlegroups.com
Please check the compatibility guide.  2.6 version is not compatible with 3.0 as we are moving forward.  Changes will be made,.

Inject is new for 3.0 ONLY and it will be the new standard instead of hijacking the "type" attribute like we did in 2.6.4.  We will also deprecate _wireme in favor of inject also.

Luis


Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com


namtax

unread,
Dec 11, 2009, 3:43:03 PM12/11/09
to ColdBox Platform
Ok, thanks for your responses.

I have installed coldbox 3, and it appears to be working now..

Mamy thanks
Reply all
Reply to author
Forward
0 new messages