Model Injection Not Working

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

Just out of curiosity, in your coldbox.xml.cfm, do you have the autowire interceptor enabled?

true

For v 2.6.4 you do have to explicitly enable it.

Doug :0)

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

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

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

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

Ok, thanks for your responses.

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

Mamy thanks