I believe that he's describing the following: 1. Create a separate file which contains all of the setter functions for the services. Call that applicationServices.cfm. 2. Inside each of your controller cfcs, simply <cfinclude> that file, thereby injecting each of those setter methods into your controller.
That way, when you add a new service you only have to add a setter to applicationServices.cfm and it will automatically end up in each controller. I actually take a somewhat different approach, although I'm not doing it with MG, so I'm not sure if it will work. Rather than using a mixin (the <cfinclude> technique described above), I create a Base cfc which contains all of the setters, and then I base all of my concrete cfcs (in this example your controller cfcs) on that Base cfc (using the extends attribute). Not suggesting that that's a better approach, just another alternative. On Fri, Sep 12, 2008 at 5:49 AM, cs01rsw <[EMAIL PROTECTED]> wrote: > > hi > > i just read the article on 'what the hell is auto wiring' > > http://www.firemoss.com/post.cfm/ModelGlue--What-the-hell-is-autowiring > > it does make sense but there was only one point that confused me a > little: > > i understand passing services into each cfc and understand that if a > new service is added that the problem is that we have to go into all > cfc's and add a setter function, and he does mention something at the > end of the article to do with mixin, which sounds great but i dont > quite understand exactly how to achieve this. > > the quote was: > > 'What I've done there is move all of these "set[Something" functions > to a file called /model/mixin/applicationServices.cfm that each of my > controllers (becoming a "static mixin"). That way, if a new service > pops up, I add a setter function to one file, and it's available in > all services! Now that's much nicer writing init() plumbing code in > specific controllers!!' > > can someone provide an example of how this would work as i cannot > quite grasp exactly how i would achieve this > > thanks again for your help > > richard > > > -- Bob Silverberg www.silverwareconsulting.com --~--~---------~--~----~------------~-------~--~----~ 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 For more about Model-Glue, check http://www.model-glue.com . -~----------~----~----~----~------~----~------~--~---
