Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
model inject model dependency and ocm
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 31 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
chris hough  
View profile  
 More options Feb 7, 9:56 am
From: chris hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 06:56:26 -0800 (PST)
Local: Tues, Feb 7 2012 9:56 am
Subject: model inject model dependency and ocm
I have a bunch of code to paste, so I am going to try to set this up
pseudo code style.  here is the layout of what I have that is throwing
the error:

Model A
Model B

Model A
    Inject Ocm
    Inject Model B
    Call Method in B

Model B
    Inject Ocm

when model a tries to inject model b and model b has an ocm injection,
I am getting an undefined error on the ocm injection variable

this is the function that errors in model b when it's called via the
model injection from model A

        <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>

model a:
<cfproperty name="Permissions"inject="Model" scope="Instance"/>

the function call:

var qPermissions=Instance.Permissions.qUserLevels(HasMenu=1);

any tips or pointers?  can this be done or should I use the
controllers to pass in the model dependencies?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 11:20 am
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 09:20:03 -0700
Local: Tues, Feb 7 2012 11:20 am
Subject: RE: [coldbox:13639] model inject model dependency and ocm
1)  How are you injecting your ocm dependency?  i.e.  Property annotations, WireBox config mappings, manually retrieving it from WireBox on init?
2) Where in your component are you trying to use it.  i.e.  init() is called before DI is complete so you can't use dependencies there.  That's what onDIComplete() is for.

Also, what version of ColdBox are you on and what is your DI engine? (legacy Bean factory, WireBox, ColdSpring, LightWire, etc)

Thanks!

~Brad
-------- Original Message --------
Subject: [coldbox:13639] model inject model dependency and ocm
From: chris hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 8:56 am
To: ColdBox Platform <coldbox@googlegroups.com>

I have a bunch of code to paste, so I am going to try to set this up
pseudo code style. here is the layout of what I have that is throwing
the error:

Model A
Model B

Model A
Inject Ocm
Inject Model B
Call Method in B

Model B
Inject Ocm

when model a tries to inject model b and model b has an ocm injection,
I am getting an undefined error on the ocm injection variable

this is the function that errors in model b when it's called via the
model injection from model A

<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>

model a:
<cfproperty name="Permissions"inject="Model" scope="Instance"/>

the function call:

var qPermissions=Instance.Permissions.qUserLevels(HasMenu=1);

any tips or pointers? can this be done or should I use the
controllers to pass in the model dependencies?

--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
chris hough  
View profile  
 More options Feb 7, 11:26 am
From: chris hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 08:26:16 -0800 (PST)
Local: Tues, Feb 7 2012 11:26 am
Subject: Re: model inject model dependency and ocm
I am using "<cfproperty name="DataUserLevels" inject="Ocm"
scope="Instance"/>"

to inject them on top, running cb 3.1, adobe cf8, I am using it after
the init() in side of the method.

On Feb 7, 11:20 am, <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 11:33 am
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 09:33:31 -0700
Local: Tues, Feb 7 2012 11:33 am
Subject: 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
-------- Original Message --------
Subject: [coldbox:13641] Re: model inject model dependency and ocm
From: chris hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 10:26 am
To: ColdBox Platform <coldbox@googlegroups.com>

I am using "<cfproperty name="DataUserLevels" inject="Ocm"
scope="Instance"/>"

to inject them on top, running cb 3.1, adobe cf8, I am using it after
the init() in side of the method.

On Feb 7, 11:20 am, <b...@bradwood.com> wrote:
> 1)  How are you injecting your ocm dependency?  i.e.  Property annotations, WireBox config mappings, manually retrieving it from WireBox on init?
>
> 2) Where in your component are you trying to use it.  i.e.  init() is called before DI is complete so you can't use dependencies there.  That's what onDIComplete() is for.
>
>
>
> Also, what version of ColdBox are you on and what is your DI engine? (legacy Bean factory, WireBox, ColdSpring, LightWire, etc)
>
>
>
> Thanks!
>
>
>
> ~Brad
>
> -------- Original Message --------
> Subject: [coldbox:13639] model inject model dependency and ocm
> From: chris hough <chrismhough@gmail.com>
> Date: Tue, February 07, 2012 8:56 am
> To: ColdBox Platform <coldbox@googlegroups.com>
> I have a bunch of code to paste, so I am going to try to set this up
> pseudo code style. here is the layout of what I have that is throwing
> the error:
> Model A
> Model B
> Model A
> Inject Ocm
> Inject Model B
> Call Method in B
> Model B
> Inject Ocm
> when model a tries to inject model b and model b has an ocm injection,
> I am getting an undefined error on the ocm injection variable
> this is the function that errors in model b when it's called via the
> model injection from model A
> <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>
> model a:
> <cfproperty name="Permissions"inject="Model" scope="Instance"/>
> the function call:
> var qPermissions=Instance.Permissions.qUserLevels(HasMenu=1);
> any tips or pointers? can this be done or should I use the
> controllers to pass in the model dependencies?
> --
> You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
> To post to this group, send email tocoldbox@googlegroups.com
> To unsubscribe from this group, send email tocoldbox-unsubscribe@googlegroups.com
> For more options, visit this group athttp://groups-beta.google.com/group/coldbox
> For News, visithttp://blog.coldbox.org
> For Documentation, visithttp://wiki.coldbox.org

--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
chris hough  
View profile  
 More options Feb 7, 11:35 am
From: chris hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 08:35:38 -0800 (PST)
Local: Tues, Feb 7 2012 11:35 am
Subject: Re: model inject model dependency and ocm
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>

On Feb 7, 11:33 am, <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 11:57 am
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 09:57:50 -0700
Local: Tues, Feb 7 2012 11:57 am
Subject: RE: [coldbox:13643] Re: model inject model dependency and ocm
Yeah, I'm not sure.  I'll admit, I'm having troubles following the flow of execution.

Can you show your method in menu that is calling the method in permissions that is erroring?

When you say "If I remove the call to the injected OCM Instance variable and call the method directly it works." do you mean when you remove the reference to instance.DataUserLevels in the Permissions component? 

Also, I know you are injecting your properties into "instance", but it's rather confusing to have methods and instance vars with the same name.  Did you try injecting them with a different name just to see if that changes anything.


-------- Original Message --------
Subject: [coldbox:13643] Re: model inject model dependency and ocm
From: chris hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 10:35 am
To: ColdBox Platform <coldbox@googlegroups.com>

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>




On Feb 7, 11:33 am, <b...@bradwood.com> wrote:
> 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
>
> -------- Original Message --------
> Subject: [coldbox:13641] Re: model inject model dependency and ocm
> From: chris hough <chrismhough@gmail.com>
> Date: Tue, February 07, 2012 10:26 am
> To: ColdBox Platform <coldbox@googlegroups.com>
> I am using "<cfproperty name="DataUserLevels" inject="Ocm"
> scope="Instance"/>"
> to inject them on top, running cb 3.1, adobe cf8, I am using it after
> the init() in side of the method.
> On Feb 7, 11:20 am, <b...@bradwood.com> wrote:
> > 1)  How are you injecting your ocm dependency?  i.e.  Property annotations, WireBox config mappings, manually retrieving it from WireBox on init?
> >
> > 2) Where in your component are you trying to use it.  i.e.  init() is called before DI is complete so you can't use dependencies there.  That's what onDIComplete() is for.
> >
> >
> >
> > Also, what version of ColdBox are you on and what is your DI engine? (legacy Bean factory, WireBox, ColdSpring, LightWire, etc)
> >
> >
> >
> > Thanks!
> >
> >
> >
> > ~Brad
> >
> > -------- Original Message --------
> > Subject: [coldbox:13639] model inject model dependency and ocm
> > From: chris hough <chrismhough@gmail.com>
> > Date: Tue, February 07, 2012 8:56 am
> > To: ColdBox Platform <coldbox@googlegroups.com>
> > I have a bunch of code to paste, so I am going to try to set this up
> > pseudo code style. here is the layout of what I have that is throwing
> > the error:
> > Model A
> > Model B
> > Model A
> > Inject Ocm
> > Inject Model B
> > Call Method in B
> > Model B
> > Inject Ocm
> > when model a tries to inject model b and model b has an ocm injection,
> > I am getting an undefined error on the ocm injection variable
> > this is the function that errors in model b when it's called via the
> > model injection from model A
> > <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>
> > model a:
> > <cfproperty name="Permissions"inject="Model" scope="Instance"/>
> > the function call:
> > var qPermissions=Instance.Permissions.qUserLevels(HasMenu=1);
> > any tips or pointers? can this be done or should I use the
> > controllers to pass in the model dependencies?
> > --
> > You
...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 12:04 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 12:04:59 -0500
Local: Tues, Feb 7 2012 12:04 pm
Subject: Re: [coldbox:13728] Re: model inject model dependency and ocm

Here are the full files:

i think this will be far easier

did this help?

Chris Hough

On Feb 7, 2012, at 11:57 AM, <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 12:13 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 10:13:50 -0700
Local: Tues, Feb 7 2012 12:13 pm
Subject: RE: [coldbox:13644] Re: model inject model dependency and ocm
One other thing, are DataUserLevels and DataNav eternal objects in the cache?  If you are reinitting, make sure they are put in the cache prior to trying to inject them.

~Brad
-------- Original Message --------
Subject: RE: [coldbox:13644] Re: model inject model dependency and ocm
From: <brad@bradwood.com>
Date: Tue, February 07, 2012 10:57 am
To: coldbox@googlegroups.com

Yeah, I'm not sure.  I'll admit, I'm having troubles following the flow of execution.

Can you show your method in menu that is calling the method in permissions that is erroring?

When you say "If I remove the call to the injected OCM Instance variable and call the method directly it works." do you mean when you remove the reference to instance.DataUserLevels in the Permissions component? 

Also, I know you are injecting your properties into "instance", but it's rather confusing to have methods and instance vars with the same name.  Did you try injecting them with a different name just to see if that changes anything.


-------- Original Message --------
Subject: [coldbox:13643] Re: model inject model dependency and ocm
From: chris hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 10:35 am
To: ColdBox Platform <coldbox@googlegroups.com>

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>




On Feb 7, 11:33 am, <b...@bradwood.com> wrote:
> 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
>
> -------- Original Message --------
> Subject: [coldbox:13641] Re: model inject model dependency and ocm
> From: chris hough <chrismhough@gmail.com>
> Date: Tue, February 07, 2012 10:26 am
> To: ColdBox Platform <coldbox@googlegroups.com>
> I am using "<cfproperty name="DataUserLevels" inject="Ocm"
> scope="Instance"/>"
> to inject them on top, running cb 3.1, adobe cf8, I am using it after
> the init() in side of the method.
> On Feb 7, 11:20 am, <b...@bradwood.com> wrote:
> > 1)  How are you injecting your ocm dependency?  i.e.  Property annotations, WireBox config mappings, manually retrieving it from WireBox on init?
> >
> > 2) Where in your component are you trying to use it.  i.e.  init() is called before DI is complete so you can't use dependencies there.  That's what onDIComplete() is for.
> >
> >
> >
> > Also, what version of ColdBox are you on and what is your DI engine? (legacy Bean factory, WireBox, ColdSpring, LightWire, etc)
> >
> >
> >
> > Thanks!
> >
> >
> >
> > ~Brad
> >
> > -------- Original Message --------
> > Subject: [coldbox:13639] model inject model dependency and ocm
> > From: chris hough <chrismhough@gmail.com>
> > Date: Tue, February 07, 2012 8:56 am
> > To: ColdBox Platform <coldbox@googlegroups.com>
> > I have a bunch of code to paste, so I am going to try to set this up
> > pseudo code style. here is the layout of what I have that is throwing
> > the error:
> > Model A
> > Model B
> > Model A
> > Inject Ocm
> > Inject Model B
> > Call Method in B
> > Model B
> > Inject Ocm
> > when model a tries to inject model b and model b has an ocm injection,
> > I am getting an undefined error on the ocm injection variable
> > this is the function that errors in model b when it's called via the
> > model injection from model A
> > <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'>
>
...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 12:20 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 12:20:26 -0500
Local: Tues, Feb 7 2012 12:20 pm
Subject: Re: [coldbox:13730] model inject model dependency and ocm

here is the snippet relative to the ocm, it's in the main handler

        <cffunction name="onAppInit" returntype="void" output="false">
                <cfargument name="event" required="true">
                <cfscript>
                        //cache global data queries
                        var DataCompany = getModel('Company').DataCompany();
                        var DataMall = getModel('Mall').DataMall();
                        var DataStates = getModel('Information').DataStates();
                        var DataUserLevels = getModel('Permissions').DataUserLevels();
                        var DataNav = getModel('Menu').DataNav();
                        //Place in cache indefinitely until application reinitializes.
                        getColdBoxOCM().set('DataCompany',DataCompany,0);
                        getColdBoxOCM().set('DataMall',DataMall,0);
                        getColdBoxOCM().set('DataStates',DataStates,0);
                        getColdBoxOCM().set('DataUserLevels',DataUserLevels,0);
                        getColdBoxOCM().set('DataNav',DataNav,0);
                </cfscript>
        </cffunction>

Chris Hough

On Feb 7, 2012, at 12:13 PM, <b...@bradwood.com> <b...@bradwood.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 12:26 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 10:26:03 -0700
Local: Tues, Feb 7 2012 12:26 pm
Subject: RE: [coldbox:13645] Re: model inject model dependency and ocm
Thanks for sending the full files.  Let me see if I have this straight.  My understanding is that menu has permissions injected into it.  Then menu.navRoutesByLevel() is called which, in turn, calls the Instance.Permissions.qUserLevel().  Then qUserLevels() errors because it can't find Instance.DataUserLevels, which you currently have commented out and replaced with a direct call to UserLevels()
 which I can only assume is used to populate DataUserLevels in the cache.

So firstly, how and when in your application lifecycle is DataUserLevels placed in the cache, and what is its expiration?
What happens if you ignore menu and just call Permissions.qUserLevel() directly from a test page somewhere?
Also, I'm not sure if it matters, but are menu and permissions transient objects?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13645] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 11:04 am
To: coldbox@googlegroups.com, brad@bradwood.com

Here are the full files:


--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org



i think this will be far easier

did this help?

Chris Hough

On Feb 7, 2012, at 11:57 AM, <brad@bradwood.com> wrote:

Yeah, I'm not sure.  I'll admit, I'm having troubles following the flow of execution.

Can you show your method in menu that is calling the method in permissions that is erroring?

When you say "If I remove the call to the injected OCM Instance variable and call the method directly it works." do you mean when you remove the reference to instance.DataUserLevels in the Permissions component? 

Also, I know you are injecting your properties into "instance", but it's rather confusing to have methods and instance vars with the same name.  Did you try injecting them with a different name just to see if that changes anything.


-------- Original Message --------
Subject: [coldbox:13643] Re: model inject model dependency and ocm
From: chris hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 10:35 am
To: ColdBox Platform <coldbox@googlegroups.com>

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>




On Feb 7, 11:33 am, <b...@bradwood.com> wrote:
> 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
>
> -------- Original Message --------
> Subject: [coldbox:13641] Re: model inject model dependency and ocm
> From: chris hough <chrismhough@gmail.com>
> Date: Tue, February 07, 2012 10:26 am
> To: ColdBox Platform <coldbox@googlegroups.com>
> I am using "<cfproperty name="DataUserLevels" inject="Ocm"
> scope="Instance"/>"
> to inject them on top, running cb 3.1, adobe cf8, I am using it after
> the init() in side of the method.
> On Feb 7, 11:20 am, <b...@bradwood.com> wrote:
> > 1)  How are you injecting your ocm dependency?  i.e.  Property annotations, WireBox config mappings, manually retrieving it from WireBox on init?
> >
> > 2) Where in your component are you trying to use it.  i.e.  init() is called before DI is complete so you can't use dependencies there.  That's what onDIComplete() is for.
> >
> >
> >
> > Also, what version of ColdBox are you on and what is your DI engine? (legacy Bean factory, WireBox, ColdSpring,
...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 12:28 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 12:28:30 -0500
Local: Tues, Feb 7 2012 12:28 pm
Subject: Re: [coldbox:13732] Re: model inject model dependency and ocm

transient objects?

I add the OCM values inside the main handler that runs before anything else executes, at least I thought it was supposed to work like that.

Chris Hough

On Feb 7, 2012, at 12:26 PM, <b...@bradwood.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 12:37 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 10:37:22 -0700
Local: Tues, Feb 7 2012 12:37 pm
Subject: RE: [coldbox:13732] Re: model inject model dependency and ocm
Not the objects in cache, the actual menu and permission CFCs.  Are they singleton objects that only exist once, or are there many instances of them created (and injected) over the course of your application life cycle?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13732] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 11:28 am
To: coldbox@googlegroups.com, brad@bradwood.com

transient objects?

I add the OCM values inside the main handler that runs before anything else executes, at least I thought it was supposed to work like that.

Chris Hough

On Feb 7, 2012, at 12:26 PM, <brad@bradwood.com> wrote:

Thanks for sending the full files.  Let me see if I have this straight.  My understanding is that menu has permissions injected into it.  Then menu.navRoutesByLevel() is called which, in turn, calls the Instance.Permissions.qUserLevel().  Then qUserLevels() errors because it can't find Instance.DataUserLevels, which you currently have commented out and replaced with a direct call to UserLevels()
 which I can only assume is used to populate DataUserLevels in the cache.

So firstly, how and when in your application lifecycle is DataUserLevels placed in the cache, and what is its expiration?
What happens if you ignore menu and just call Permissions.qUserLevel() directly from a test page somewhere?
Also, I'm not sure if it matters, but are menu and permissions transient objects?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13645] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 11:04 am
To: coldbox@googlegroups.com, brad@bradwood.com

Here are the full files:


--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org



i think this will be far easier

did this help?

Chris Hough

On Feb 7, 2012, at 11:57 AM, <brad@bradwood.com> wrote:

Yeah, I'm not sure.  I'll admit, I'm having troubles following the flow of execution.

Can you show your method in menu that is calling the method in permissions that is erroring?

When you say "If I remove the call to the injected OCM Instance variable and call the method directly it works." do you mean when you remove the reference to instance.DataUserLevels in the Permissions component? 

Also, I know you are injecting your properties into "instance", but it's rather confusing to have methods and instance vars with the same name.  Did you try injecting them with a different name just to see if that changes anything.


-------- Original Message --------
Subject: [coldbox:13643] Re: model inject model dependency and ocm
From: chris hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 10:35 am
To: ColdBox Platform <coldbox@googlegroups.com>

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
...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 12:39 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 12:39:03 -0500
Local: Tues, Feb 7 2012 12:39 pm
Subject: Re: [coldbox:13734] Re: model inject model dependency and ocm

they are injected, rather will be injected in various handlers at different times.

Chris Hough

On Feb 7, 2012, at 12:37 PM, <b...@bradwood.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 12:51 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 10:51:49 -0700
Local: Tues, Feb 7 2012 12:51 pm
Subject: RE: [coldbox:13651] Re: model inject model dependency and ocm
That doesn't answer the question, but unless you are declaring the mappings in your WireBox config as .asSingleton() I'll assume they are transient.  i.e.  if you inject menu into two different handlers, each handler has a separate instance of the menu object.

No matter, that was really just a side question. 
Did you try calling Permissions.qUserLevel() directly from a test page somewhere?

Also, you could try catch the error, and dump/abort out the instance/variables scope to see what exists at the time that it is erroring.

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13651] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 11:39 am
To: coldbox@googlegroups.com

they are injected, rather will be injected in various handlers at different times. 

Chris Hough

On Feb 7, 2012, at 12:37 PM, <brad@bradwood.com> wrote:

Not the objects in cache, the actual menu and permission CFCs.  Are they singleton objects that only exist once, or are there many instances of them created (and injected) over the course of your application life cycle?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13732] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 11:28 am
To: coldbox@googlegroups.com, brad@bradwood.com

transient objects?

I add the OCM values inside the main handler that runs before anything else executes, at least I thought it was supposed to work like that.

Chris Hough

On Feb 7, 2012, at 12:26 PM, <brad@bradwood.com> wrote:

Thanks for sending the full files.  Let me see if I have this straight.  My understanding is that menu has permissions injected into it.  Then menu.navRoutesByLevel() is called which, in turn, calls the Instance.Permissions.qUserLevel().  Then qUserLevels() errors because it can't find Instance.DataUserLevels, which you currently have commented out and replaced with a direct call to UserLevels()
 which I can only assume is used to populate DataUserLevels in the cache.

So firstly, how and when in your application lifecycle is DataUserLevels placed in the cache, and what is its expiration?
What happens if you ignore menu and just call Permissions.qUserLevel() directly from a test page somewhere?
Also, I'm not sure if it matters, but are menu and permissions transient objects?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13645] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 11:04 am
To: coldbox@googlegroups.com, brad@bradwood.com

Here are the full files:


--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org



i think this will be far easier

did this help?

Chris Hough

On Feb 7, 2012, at 11:57 AM, <brad@bradwood.com> wrote:

Yeah, I'm not sure.  I'll admit, I'm having troubles following the flow of execution.

Can you show your method in menu that is calling the method in permissions that is erroring?

When you say "If I remove the call to the injected OCM Instance variable and call the method directly it works." do you mean when you remove the reference to instance.DataUserLevels in the Permissions component? 

Also, I know you are injecting your properties into "instance", but it's rather confusing to have methods and instance vars with the same name.  Did you try injecting them with a different name just to see if that changes anything.


-------- Original Message --------
Subject: [coldbox:13643] Re: model inject model dependency and ocm
From: chris hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 10:35 am
To: ColdBox Platform <coldbox@googlegroups.com>

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>
...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 12:53 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 12:53:31 -0500
Local: Tues, Feb 7 2012 12:53 pm
Subject: Re: [coldbox:13737] Re: model inject model dependency and ocm

to avoid the confusion, those are 2 models talking talking to one another, not handlers.  

yes, the query works on its own, it only errors when I attempt to use the inject OCM variable.  

Chris Hough

On Feb 7, 2012, at 12:51 PM, <b...@bradwood.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 2:05 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 12:05:07 -0700
Local: Tues, Feb 7 2012 2:05 pm
Subject: RE: [coldbox:13737] Re: model inject model dependency and ocm
> to avoid the confusion, those are 2 models talking talking to one another, not handlers.  

Yes I know-- I was just trying pin-point if the ocm injection happened once when the app started up (i.e. menu and permissions were singletons) or if it happened over and over throughout the life of the app each time a new menu and permission object was created. 

> yes, the query works on its own, it only errors when I attempt to use the inject OCM variable.  

Sorry, not what I meant.  Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler?  You original post seemed to indicate that the broken behavior in Permissions.qUserLevel() was only present when it it was called from the menu object.

Also, to back up a bit, what fires the onAppInit() method? 

~Brad

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 2:45 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 14:45:32 -0500
Local: Tues, Feb 7 2012 2:45 pm
Subject: Re: [coldbox:13743] Re: model inject model dependency and ocm

> Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler?

yes, it works as expected

> what fires the onAppInit() method?

my understanding is the framework calls that when the application is reinitialized.  is that incorrect?

Chris Hough

On Feb 7, 2012, at 2:05 PM, <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 4:37 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 14:37:37 -0700
Local: Tues, Feb 7 2012 4:37 pm
Subject: RE: [coldbox:13743] Re: model inject model dependency and ocm
> my understanding is the framework calls that when the application is reinitialized.  is that incorrect?

It depends on the applicationStartHandler setting in your config.  If it is set to "main.onAppInit" then it probably gets called.

Did you try turning on the WireBox debugging via LogBox to try and see what is happening when the permission object is injected (and autowired)?
What about try/catching the error and dumping out the contents of "variables"?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13743] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 1:45 pm
To: coldbox@googlegroups.com, brad@bradwood.com

Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler? 

yes, it works as expected

what fires the onAppInit() method? 

my understanding is the framework calls that when the application is reinitialized.  is that incorrect?

Chris Hough

On Feb 7, 2012, at 2:05 PM, <brad@bradwood.com> wrote:

> to avoid the confusion, those are 2 models talking talking to one another, not handlers.  

Yes I know-- I was just trying pin-point if the ocm injection happened once when the app started up (i.e. menu and permissions were singletons) or if it happened over and over throughout the life of the app each time a new menu and permission object was created. 

> yes, the query works on its own, it only errors when I attempt to use the inject OCM variable.  

Sorry, not what I meant.  Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler?  You original post seemed to indicate that the broken behavior in Permissions.qUserLevel() was only present when it it was called from the menu object.

Also, to back up a bit, what fires the onAppInit() method? 

~Brad

--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 4:56 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 16:56:53 -0500
Local: Tues, Feb 7 2012 4:56 pm
Subject: Re: [coldbox:13743] model inject model dependency and ocm

this is really weird, it appears to be working now.  yes I was reinit the framework each time, but it was never working.  

I restarted the server and bam it is working now.  seems odd.  can models inject models, or should i use handlers only?

Chris Hough

On Feb 7, 2012, at 4:37 PM, <b...@bradwood.com> <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 5:01 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 15:01:24 -0700
Local: Tues, Feb 7 2012 5:01 pm
Subject: RE: [coldbox:13669] model inject model dependency and ocm
Anything can pretty much inject anything.  Please welcome your new Wirebox overlord.

Glad to hear it seems to be working for now.

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13669] model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 3:56 pm
To: <brad@bradwood.com> <brad@bradwood.com>
Cc: coldbox@googlegroups.com

this is really weird, it appears to be working now.  yes I was reinit the framework each time, but it was never working.  

I restarted the server and bam it is working now.  seems odd.  can models inject models, or should i use handlers only?

Chris Hough

On Feb 7, 2012, at 4:37 PM, <brad@bradwood.com> <brad@bradwood.com> wrote:

> my understanding is the framework calls that when the application is reinitialized.  is that incorrect?

It depends on the applicationStartHandler setting in your config.  If it is set to "main.onAppInit" then it probably gets called.

Did you try turning on the WireBox debugging via LogBox to try and see what is happening when the permission object is injected (and autowired)?
What about try/catching the error and dumping out the contents of "variables"?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13743] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 1:45 pm
To: coldbox@googlegroups.com, brad@bradwood.com

Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler? 

yes, it works as expected

what fires the onAppInit() method? 

my understanding is the framework calls that when the application is reinitialized.  is that incorrect?

Chris Hough

On Feb 7, 2012, at 2:05 PM, <brad@bradwood.com> wrote:

> to avoid the confusion, those are 2 models talking talking to one another, not handlers.  

Yes I know-- I was just trying pin-point if the ocm injection happened once when the app started up (i.e. menu and permissions were singletons) or if it happened over and over throughout the life of the app each time a new menu and permission object was created. 

> yes, the query works on its own, it only errors when I attempt to use the inject OCM variable.  

Sorry, not what I meant.  Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler?  You original post seemed to indicate that the broken behavior in Permissions.qUserLevel() was only present when it it was called from the menu object.

Also, to back up a bit, what fires the onAppInit() method? 

~Brad

--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org


--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 6:08 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 18:08:37 -0500
Local: Tues, Feb 7 2012 6:08 pm
Subject: Re: [coldbox:13754] model inject model dependency and ocm

HA, just when I said that it borked again.  geez.  

I am not sure if I should move the injection out completely or what....

here is the dump:

Chris Hough

On Feb 7, 2012, at 5:01 PM, <b...@bradwood.com> <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
b...@bradwood.com  
View profile  
 More options Feb 7, 6:22 pm
From: <b...@bradwood.com>
Date: Tue, 07 Feb 2012 16:22:21 -0700
Local: Tues, Feb 7 2012 6:22 pm
Subject: RE: [coldbox:13754] model inject model dependency and ocm
After the error can you look in the CacheBox cache manager and see if that object is still in the cache?


~Brad
-------- Original Message --------
Subject: Re: [coldbox:13754] model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 5:08 pm
To: coldbox@googlegroups.com, brad@bradwood.com

HA, just when I said that it borked again.  geez.  

I am not sure if I should move the injection out completely or what....

here is the dump:


Chris Hough

On Feb 7, 2012, at 5:01 PM, <brad@bradwood.com> <brad@bradwood.com> wrote:

Anything can pretty much inject anything.  Please welcome your new Wirebox overlord.

Glad to hear it seems to be working for now.

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13669] model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 3:56 pm
To: <brad@bradwood.com> <brad@bradwood.com>
Cc: coldbox@googlegroups.com

this is really weird, it appears to be working now.  yes I was reinit the framework each time, but it was never working.  

I restarted the server and bam it is working now.  seems odd.  can models inject models, or should i use handlers only?

Chris Hough

On Feb 7, 2012, at 4:37 PM, <brad@bradwood.com> <brad@bradwood.com> wrote:

> my understanding is the framework calls that when the application is reinitialized.  is that incorrect?

It depends on the applicationStartHandler setting in your config.  If it is set to "main.onAppInit" then it probably gets called.

Did you try turning on the WireBox debugging via LogBox to try and see what is happening when the permission object is injected (and autowired)?
What about try/catching the error and dumping out the contents of "variables"?

Thanks!

~Brad
-------- Original Message --------
Subject: Re: [coldbox:13743] Re: model inject model dependency and ocm
From: Chris Hough <chrismhough@gmail.com>
Date: Tue, February 07, 2012 1:45 pm
To: coldbox@googlegroups.com, brad@bradwood.com

Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler? 

yes, it works as expected

what fires the onAppInit() method? 

my understanding is the framework calls that when the application is reinitialized.  is that incorrect?

Chris Hough

On Feb 7, 2012, at 2:05 PM, <brad@bradwood.com> wrote:

> to avoid the confusion, those are 2 models talking talking to one another, not handlers.  

Yes I know-- I was just trying pin-point if the ocm injection happened once when the app started up (i.e. menu and permissions were singletons) or if it happened over and over throughout the life of the app each time a new menu and permission object was created. 

> yes, the query works on its own, it only errors when I attempt to use the inject OCM variable.  

Sorry, not what I meant.  Does the Permissions.qUserLevel() method "see" the Instance.DataUserLevels variable when it is called directly in a test view or handler?  You original post seemed to indicate that the broken behavior in Permissions.qUserLevel() was only present when it it was called from the menu object.

Also, to back up a bit, what fires the onAppInit() method? 

~Brad

--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org


--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to coldbox@googlegroups.com
To unsubscribe from this group, send email to coldbox-unsubscribe@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 6:28 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 18:28:40 -0500
Local: Tues, Feb 7 2012 6:28 pm
Subject: Re: [coldbox:13757] model inject model dependency and ocm

If I use this around the block to test:

                <cftry>
                <cfscript>
                        //var qUserLevels=UserLevels();
                        qUserLevels=Instance.DataUserLevels;
                        qUserLevelsOut=[];
                </cfscript>
                <cfcatch type="any">
                        <cfdump var="#variables#" expand="false">
                        <cfaborT>
                </cfcatch>
                </cftry>

mysite.com/?fwreinit=20120207&debugpanel=cache&debugmode=1  is not showing any panel :(

Chris Hough

On Feb 7, 2012, at 6:22 PM, <b...@bradwood.com> <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
brad@bradwood.com  
View profile  
 More options Feb 7, 7:43 pm
From: "b...@bradwood.com" <b...@bradwood.com>
Date: Tue, 07 Feb 2012 18:43:30 -0600
Local: Tues, Feb 7 2012 7:43 pm
Subject: Re: [coldbox:13757] model inject model dependency and ocm

What does the dump show when it errors?  

You may need to turn debug mode on in your config for the cache panel to show.

~Brad

Sent from my HTC on the Now Network from Sprint!

----- Reply message -----
From: "Chris Hough" <chrismho...@gmail.com>
Date: Tue, Feb 7, 2012 5:28 pm
Subject: [coldbox:13757] model inject model dependency and ocm
To: <coldbox@googlegroups.com>, <b...@bradwood.com>

If I use this around the block to test:

                <cftry>
                <cfscript>
                        //var qUserLevels=UserLevels();
                        qUserLevels=Instance.DataUserLevels;
                        qUserLevelsOut=[];
                </cfscript>
                <cfcatch type="any">
                        <cfdump var="#variables#" expand="false">
                        <cfaborT>
                </cfcatch>
                </cftry>

mysite.com/?fwreinit=20120207&debugpanel=cache&debugmode=1  is not showing any panel :(

Chris Hough

On Feb 7, 2012, at 6:22 PM, <b...@bradwood.com> <b...@bradwood.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Hough  
View profile  
 More options Feb 7, 7:47 pm
From: Chris Hough <chrismho...@gmail.com>
Date: Tue, 7 Feb 2012 19:47:13 -0500
Local: Tues, Feb 7 2012 7:47 pm
Subject: Re: [coldbox:13759] model inject model dependency and ocm

it just shows standard cf debug:

yes, debug mode is set to true

If I go switch all this back to not use the OCM injecting I get the debug panels at the bottom of the screen as usual.  

thank you so much for your help btw.  thoughts?

Chris Hough

On Feb 7, 2012, at 7:43 PM, b...@bradwood.com wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 31   Newer >
« Back to Discussions « Newer topic     Older topic »