Just shooting in the dark here, but from your child controllers, can you reference the bean scope by hitting super first? <cfset something = super.beans.userService.getName() /> ????
On Wed, Jun 2, 2010 at 4:10 PM, Nolan Erck <[email protected]> wrote: > Hi all -- > > I've got an MG3 app with multiple controllers (one for each "section" of > the site). I've also got all of my controllers inheriting from a > BaseController CFC that looks like so: > > BaseController.cfc: > <cfcomponent output="false" > extends="ModelGlue.gesture.controller.Controller"> > <!--- ================================================================= > ---> > <!--- constructor ---> > <cffunction name="init" access="public" output="false" > hint="Constructor"> > <cfargument name="framework" /> > > <cfset super.init(framework) /> > > <cfreturn this /> > </cffunction> > > <!--- ================================================================= > ---> > <!--- onRequestStart ---> > <cffunction name="onRequestStart" access="public" output="false"> > <cfargument name="event" type="any"> > > <!--- copy settings to the Event scope so we can use it all the > time. ---> > <cfif beans.userService.IsLoggedIn()> > <cfset arguments.event.setValue( "isLoggedIn", true ) /> > <cfset arguments.event.setValue( "currentuser", > beans.userService.getCurrentUser() ) /> > <cfelse> > <cfset arguments.event.setValue( "isLoggedIn", false ) /> > </cfif> > > </cffunction> > </cfcomponent> > > Nothing too crazy there. You'll see that I use the "beans" scope in > onRequestStart() to hit my UserService -- that's the line causing me > trouble. Though beans.userService is ONLY being used here in the Base > class, I have to add it in the beans scope of my child controller: > > UserController.cfc: > <cfcomponent output="false" hint="Handles User related issues." > extends="BaseController" beans="userService"> > > Changing BaseController.cfc to have it's own bean scope (with "userService" > of course) doesn't do anything: > > BaseController.cfc: > > <cfcomponent output="false" > extends="ModelGlue.gesture.controller.Controller" beans="userService"> > > ...that line gets ignored. It's as if MG is skipping any "beans=" notation > in the base class, using the one in my child class, and making it accessible > in the base class (though there is no beans attribute supplied in > BaseController.cfc). > > Hopefully I've explained the problem clearly. Am I doing something wrong > here? Any suggestions would be appreciated. > > Thanks, > Nolan > > > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<model-glue%[email protected]> > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en
