Thanks for the pointer Chris, i had looked there before but i could not see the wood for the trees. But that's much cleaner.
On 9 June, 07:36, Chris Blackwell <[email protected]> wrote: > Paul, > There is absolutely nothing wrong with getModelGlue().getBean(), but as > you're using MG3 you can tidy that code up quite a bit. > > Take a look at the docs on bean > injectionhttp://docs.model-glue.com/wiki/HowTos/HowToUseBeanInjection > > And if you want to get really fancy take a look at > factory-method/factory-bean in the coldspring > manualhttp://www.coldspringframework.org/downloads/ColdSpring_Reference.pdf > > Using a combination of the above you could refactor your code to one line > > <cfset qCats = beans.CategoryGateway.getAll() /> > > I'm about to head of to work so i don't have time to knock out any example > configs, but feel free to drop me a mail and i'll point you in the right > direction if you need. > > Chris > > 2009/6/9 Paul <[email protected]> > > > > > Thanks a lot Chris. Almost gave up on this but I am on my way now! > > > In case anybody is wondering this is how you could then access the > > reactor bean in your controller: > > > <cfset var reac = getModelGlue().getBean("reactor") /> > > <cfset variables.CategoryGateway = reac.createGateway > > ("mgc_categories") /> > > <!--- get all records ---> > > <cfset qCats = CategoryGateway.getAll() /> > > > On Jun 7, 10:27 pm, Chris Blackwell <[email protected]> wrote: > > > You are passing the location of your reactor.xml into your reactor > > instance > > > but what you really want is to pass a reference to the > > reactorConfiguration > > > bean. Also the way you have it setup you are creating two instances of > > > reactor factory, one is created by ModelGlue and the other you are > > creating > > > manually. You could simply alias ormservice.reactor. > > > Here's an example config > > > <alias alias="ormAdapter" name="ormAdapter.Reactor" /> > > > <alias alias="ormService" name="ormService.Reactor" /> > > > <alias alias="reactor" name="ormService.Reactor" /> > > > > <bean id="reactorConfiguration" class="reactor.config.config"> > > > <constructor-arg > > > name="pathToConfigXml"><value>/config/Reactor.xml</value></constructor-arg> > > > <property name="project"><value>myproject</value></property> > > > <property name="dsn"><value>mydsn</value></property> > > > <property name="type"><value>mysql</value></property> > > > <property name="mapping"><value>/model/data</value></property> > > > <property name="mode"><value>production</value></property> > > > </bean> > > > > Chris > > > > 2009/6/7 Paul <[email protected]> > > > > > Trying to use reactor in MG but keep getting this error (below) buy > > > > my /reactor/data/ directory does not contain 'convention' cfc only > > > > abstractconvention.cfc. I am using mg3, bleeding edge coldspring, and > > > > latest reactor > > > > > Message Bean creation exception during init() of > > > > reactor.reactorFactory > > > > Detail Could not find the ColdFusion Component or Interface > > > > reactor.data..Convention.:Ensure that the name is correct and that the > > > > component or interface exists. > > > > Extended Info > > > > Tag Context J:\ColdFusion8\wwwroot\coldspring\beans > > > > \DefaultXmlBeanFactory.cfc (817) > > > > J:\ColdFusion8\wwwroot\coldspring\beans\DefaultXmlBeanFactory.cfc > > > > (568) > > > > J:\ColdFusion8\wwwroot\ModelGlue\gesture\externaladapters\ioc > > > > \ColdSpringAdapter.cfc (22) > > > > > My coldspring xml has this > > > > > <alias alias="ormAdapter" name="ormAdapter.Reactor" /> > > > > <alias alias="ormService" name="ormService.Reactor" /> > > > > <bean id="reactorConfiguration" class="reactor.config.config"> > > > > <constructor-arg > > > > name="pathToConfigXml"><value>/mgCart/Reactor.xml</ > > > > value></constructor-arg> > > > > <property > > name="project"><value>mgCart</value></property> > > > > <property name="dsn"><value>mgCart</value></property> > > > > <property name="type"><value>mssql</value></property> > > > > <property > > > > name="mapping"><value>/mgCart/reactorData/</value></ > > > > property> > > > > <property > > name="mode"><value>development</value></property> > > > > </bean> > > > > > <bean id="reactor" class="reactor.reactorFactory"> > > > > <constructor-arg > > > > name="CONFIGURATION"><value>/mgCart/Reactor.xml</ > > > > value></constructor-arg> > > > > </bean> > > > > > and in my controller > > > > > <cfset var Cfgd = getModelGlue().getBean("reactorConfiguration") /> > > > > <cfset var Cfg4 = getModelGlue().getBean("reactor").init > > > > ("reactorConfiguration") /> --~--~---------~--~----~------------~-------~--~----~ 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 . -~----------~----~----~----~------~----~------~--~---
