"Element CONSTRUCTORDEPENDENCYSTRUCT is undefined in a CFML structure
referenced as part of an expression."
at cfLightWire2ecfc130330308$funcGETDEPENDENTOBJECTLIST.runFunction(C:
\Inetpub\wwwroot\web_skeleton_coldbox\coldbox\system\extras\lightwire
\LightWire.cfc:127)
I can create the Reactor Factory via Lightwire with no problem.
What I really want is to ask Lightwire for the user gateway, which
should be wired up to use the Reactor Factory.
I've read this thread, but didn't totally digest it.
http://groups.google.com/group/lightwireFramework/browse_thread/thread/5ac1d2ed8b17a3bc
The trick i'm looking for is how to pass the objectAlias argument with
the createGateway method?
Here's my sample code so far:
**************************
Coldbox code that creates the Reactor factory and then creates a
gateway. This works fine.
**************************
<!--- create the Reactor Factory --->
<cfset reactor = getPlugin("ioc").getBean("reactorFactory")>
<!--- create a userGateway --->
<cfset userGateway = reactor.createGateway("user") />
**************************
Here is what I am trying to achieve and have the gateway created by
lightwire as a singleton.
**************************
<cfset userGateway = getPlugin("ioc").getBean("userGateway") />
**************************
lightwire.cfc snippet
**************************
// Reactor Factory
addSingleton("reactor.reactorFactory");
addConstructorProperty("reactorFactory","configuration",getController().getSetting('reactorConfigPath'));
//Reactor User Gateway
addSingletonFromFactory("reactorFactory", "createGateway",
"userGateway");
addConstructorProperty("userGateway", "objectAlias", "user");
T
On Aug 7, 1:51 am, "Paul Marcotte" <pmarco...@gmail.com> wrote:
> Hi Terry,
>
> Clever idea you have going. Unfortunately, addSingletonFromFactory() method
> does not accept arguments to be passed to the factory method to create the
> singleton. Why not try creating your own custom factory and inject reactor
> into that? Then you could write custom methods that delegate the gateway
> creation to reactor while supporting factory methods such as
> createUserGateway().
>
> Just a thought...
>
> Paul
>
> On 8/6/07, Terry Schmitt <terry.schm...@gmail.com> wrote:
>
>
>
>
>
> > I'm trying to create a Reactor gateway singleton via Lightwire, but
> > I'm missing something and keep getting:
>
> > "Element CONSTRUCTORDEPENDENCYSTRUCT is undefined in a CFML structure
> > referenced as part of an expression."
> > at cfLightWire2ecfc130330308$funcGETDEPENDENTOBJECTLIST.runFunction(C:
> > \Inetpub\wwwroot\web_skeleton_coldbox\coldbox\system\extras\lightwire
> > \LightWire.cfc:127)
>
> > I can create the Reactor Factory via Lightwire with no problem.
> > What I really want is to ask Lightwire for the user gateway, which
> > should be wired up to use the Reactor Factory.
>
> > I've read this thread, but didn't totally digest it.
>
> >http://groups.google.com/group/lightwireFramework/browse_thread/threa...
> --
> Paul Marcotte
> Fancy Bread - in the heart or in the head?http://www.fancybread.com
>From this object, I now have access to all the Reactor gateway methods
as well as my custom methods.
I hope I explained this well enough... I'm still trying to get my head
around OOP and as always, there are a 100 different ways to do
anything!
Here is the code of my user gateway:
<cfcomponent displayname="userGateway" output="false" hint="A reactor
gateway facade">
<cffunction name="init" access="public" output="false"
returntype="any">
<cfargument name="reactorFactory" type="reactor.reactorFactory"
required="true" />
<cfset variables.reactorFactory = arguments.reactorFactory />
<!--- create a userGateway --->
<cfset variables.userGateway =
variables.reactorFactory.createGateway("user") />
<cfreturn variables.userGateway />
</cffunction>
<!-- custom code if required -->
</cfcomponent>
On Aug 8, 1:17 pm, "Paul Marcotte" <pmarco...@gmail.com> wrote:
> Hi Terry,
>
> My pleasure. Since I'm a curious fellow, can you tell me if your Gateway
> facade is a singleton that first checks if an internal data member (example:
> variables.userGateway) exists before delegating creation to Reactor?
>
> Paul
>