Hi Everyone,
When I started building my app, I had been using returnType="any" on all my
functions, and type="any" for all my cfarguments.
I recently refactored my code, changing it so that I'm using proper typing.
So, of course, something had to break. I am using CFMX6.1 with ColdSpring
and the latest Reactor code.
Here is my ColdSpring configuration (abbreviated to just the beans with the
problem):
<bean id="newsletterService" class="model.NewsletterService">
<property name="reactorFactory">
<ref bean="reactorFactory" />
</property>
<property name="newsletterGateway">
<ref bean="newsletterGateway" />
</property>
<property name="newsletterDAO">
<ref bean="newsletterDAO" />
</property>
</bean>
<bean id="newsletterGateway" factory-bean="reactorFactory"
factory-method="createGateway">
<constructor-arg name="objectAlias">
<value>newsletter</value>
</constructor-arg>
</bean>
<bean id="newsletterDAO" factory-bean="reactorFactory"
factory-method="createDAO">
<constructor-arg name="objectAlias">
<value>newsletter</value>
</constructor-arg>
</bean>
Here is my Reactor configuration:
<reactor>
<objects>
<object name="newsletter" alias="newsletter" />
</objects>
</reactor>
Here is the coldspring-related functions in my NewsletterService.cfc:
<cffunction name="getReactorFactory" access="public"
returnType="ReactorFactory" output="false" roles="" hint="">
<cfreturn variables.instance.reactorFactory />
</cffunction>
<cffunction name="setReactorFactory" returntype="void"
access="public" output="false">
<cfargument name="reactorFactory" type="any" required="true"
/>
<cfset variables.instance.reactorFactory =
arguments.reactorFactory />
</cffunction>
<cffunction name="getNewsletterGateway"
returntype="newsletterGateway" access="public" output="false">
<cfreturn variables.instance.newsletterGateway />
</cffunction>
<cffunction name="setNewsletterGateway" returntype="void"
access="public" output="false">
<cfargument name="newsletterGateway"
type="newsletterGateway" required="true" />
<cfset variables.instance.newsletterGateway =
arguments.newsletterGateway />
</cffunction>
<cffunction name="setNewsletterDAO" returntype="void"
access="public" output="false">
<cfargument name="newsletterDAO" type="any" required="true"
/>
<cfset variables.instance.newsletterDAO =
arguments.newsletterDAO />
</cffunction>
And here is my beautiful new error:
The argument NEWSLETTERGATEWAY passed to function setNewsletterGateway() is
not of type newsletterGateway.
If the component name is specified as a type of this argument, the reason
for this error might be that a definition file for such component cannot be
found or is not accessible.
The error occurred in {snipped}\NewsletterService.cfc: line 71
Line 71 is the setNewsletterGateway function.
The table in the database is named "Newsletter".
Can anyone tell me what I've done wrong?
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --