RE: [coldbox:13641] Re: model inject model dependency and ocm

Exactly where is the ocm undefined error happening. In Model A or Model B? in other words, is it that Model A can’t find the ocm or can Model B not find the ocm?

Can you confirm that injection is working in general for those objects? Perhaps enable some WireBox debug level logging and make sure there are no issues putting the dependencies in there.

Thanks!

~Brad

It is happening in model B. If I remove the call to the injected OCM
Instance variable and call the method directly it works.

Here is the top of model b:

<cfcomponent name="Permissions"
extends="cfcRetailHub.model.ApplicationModelHelper" output="false">
  <!------------------------------------------- CONSTRUCTOR
---------------------------------------------->

  <cfproperty name="Dsn" inject="Coldbox:Setting:Datasources"
scope="Instance"/>
  <cfproperty name="DataUserLevels" inject="Ocm" scope="Instance"/>

  <cffunction name="init" output="false" returntype="Permissions">
    <cfreturn this>
  </cffunction>

  <!------------------------------------------- OCM : PUBLIC
---------------------------------------------------->

  <cffunction name="DataUserLevels" access="public" returntype="query"
output="false">
    <cfscript>
      var AppLevels=UserLevels();
      return AppLevels;
    </cfscript>
  </cffunction>

  <!--- ---------------------------------------- PUBLIC
---------------------------------------------------->

  <cffunction name="qUserLevels" access="public" returntype="query"
output="false">
    <cfargument name="LevelID" type="numeric" required="false"
default="0">
    <cfargument name="HasMenu" type="numeric" required="false"
default="1">
    <cfscript>
      var qUserLevels=Instance.DataUserLevels;
      var qUserLevelsOut=[];
    </cfscript>
    <CFQUERY NAME="qUserLevelsOut" dbtype="query">
      Select LevelID,TextDesc
      From qUserLevels
      Where 0=0
      <cfif IsNumeric(Arguments.LevelID) And Arguments.LevelID GT 0>
        And LevelID = <cfqueryparam value="#Arguments.LevelID#" CFSQLType
= 'CF_SQL_NUMERIC'>
      </cfif>
      <cfif IsNumeric(Arguments.HasMenu) And Arguments.HasMenu GT 0>
        And HasMenu >= <cfqueryparam value="#Arguments.HasMenu#" CFSQLType
= 'CF_SQL_NUMERIC'>
      </cfif>
    </CFQUERY>
    <cfscript>
      return qUserLevelsOut;
    </cfscript>
  </cffunction>

top of model a:

<cfcomponent name="Menu"
extends="cfcRetailHub.model.ApplicationModelHelper" output="false">
  <!--- ---------------------------------------- CONSTRUCTOR
---------------------------------------------->
  <cfproperty name="SessionStorage"
inject="Coldbox:Plugin:SessionStorage" scope="Instance"/>
  <cfproperty name="DataNav" inject="Ocm" scope="Instance"/>
  <cfproperty name="Permissions"inject="Model" scope="Instance"/>

  <cffunction name="init" output="false" returntype="Menu">
    <cfreturn this>
  </cffunction>

  <!------------------------------------------- OCM : PUBLIC
---------------------------------------------------->

  <cffunction name="DataNav" access="public" returntype="struct"
output="false">
    <cfscript>
      var DataNav=StructNew();
      DataNav.navRoutes=navRoutes();
      DataNav.navRouteConditions=navRouteConditions();
      DataNav.navRoutesByLevel=navRoutesByLevel();

      return DataNav;
    </cfscript>
  </cffunction>

  <!--- ---------------------------------------- PUBLIC
---------------------------------------------------->

  <cffunction name="sGetNav" access="public" returntype="struct"
output="false">
    <cfscript>
      var sGetNav=StructNew();
      sGetNav=Instance.DataNav;

      return sGetNav;
    </cfscript>
  </cffunction>