How to inject Transfer bean with model

Hi,
I have a transfer decorator object and want to be able to use
functionality of a model called utils - iow inject the transfer
decorator with a model dependency. I have this (code snippets):

my transfer decorator object in models/decorators/menuDecorator.cfc
contains:

<cfcomponent output="false" extends="transfer.com.TransferDecorator"
autowire="true">

<cfproperty name="utils" type="ocm:utils" scope="variables">

  <cffunction name="addMenuItem" output="false">
    <cfargument name="rc" type="Struct">
    <cfset var local={}>

<cfdump var="#ocm#">
<cfabort>

This gives me a "Variable OCM is undefined." error.

This is my code (snippets):

1) coldbox.xml:
    <!-- USE AUTOWIRING -->
    <Interceptor class="coldbox.system.interceptors.autowire">
      <Property name="debugMode">false</Property>
      <Property name="completeDIMethodName">onDIComplete</Property>
      <Property name="enableSetterInjection">false</Property>
    </Interceptor>
    <!-- Transfer Loader -->
    <Interceptor class="coldbox.system.extras.transfer.TransferLoader">
      <Property name="ConfigPath">/transfer/config/transfer.xml</

      <Property name="definitionPath">/transfer/config/definitions</

      <Property name="datasourceAlias">cms</Property>
    </Interceptor>

2) transfer.xml:
        <!-- This table contains metadata for menuitems -->
        <object name="menu" table="menus"
decorator="model.decorators.menuDecorator">
        ...

3) models/decorators/menuDecorator.cfc:

<cfcomponent output="false" extends="transfer.com.TransferDecorator">

<cfproperty name="utils" type="ocm:utils" scope="variables">
<cfproperty name="ocm" type="ocm" scope="variables">

  <cffunction name="addMenuItem" output="false">
    <cfargument name="rc" type="Struct">
    <cfset var local={}>

<cfdump var="#ocm#">
<cfabort>

This last functiuon is called from a model called menu. Right now I
solved my problem by moving the code I needed the utils model
functionality for from te menuDecorator to my menu model. I use DI
there and sent the result as an argument to the menuDecorator
function.

Just wondering - is it possible _at all_ to use DI on a transfer
object? I can't believe it is not since am able to use DI on other
objects.

What did I leave out that this doesn't work?
Thanks,
Marc

Hi there. I think you’re getting the error because in your cfdump you’re looking for a variable named “ocm”, but you actually named the variable “utils”. Right?

That was a typo. It doens't work with <cfdump var="#ocm#">

And no, It also does not work with <cfdump var="#utils#">
I tried this

<cfproperty name="ocm" type="ocm" scope="variables">
<cfdump var="#ocm#">
<cfabort>

to see if the ColdboxOCM was available at all but it was not.
Looks Transfer has no access to Coldbox at all.. Iuse the
transferloader to place a reference to the Transfer object in the
Coldbox cache (ocm:Transfer). But the other way around - Transfer
knowing of Coldbox - is not possible. I guess Coldbox doesn't tell the
Transfer object of it's existence. It doesn't work that way

Doug,

Do you have code similar to the following in your coldbox.xml.cfm?

/${AppMapping}/config/transfer.xml.cfm /${AppMapping}/config/definitions betaAppsDsn shared.frameworks.transfer1_10.TransferFactory shared.frameworks.transfer1_10.com.config.Configuration

Tom