> Rich, so based on this, it means I should have a dogFactory for my
> dogGateway as well as my dogDAO, right?
Nope, you would have a single dogFactory to handle creation of dog
objects. In its simplest form, the dogFactory would simply return a
newly created dog instance. When inside your DAO, you would have CS
inject the dogFactory.
Here is an example read method for the dogDAO (assuming a getter/setter
for the dogFactory and that it is injected):
<cffunction name="read" access="public" returntype="path.to.dog">
<cfargument name="dogID" required="true" type="numeric" />
<cfset var qRead = "" />
<cfset var dog = "" />
<cfquery name="qRead" datasource="#dsn#">
SELECT id, breed, weight
FROM dogTable
WHERE dogID = <cfqueryparam value="#arguments.dogID#"
cfsqltype="cf_sql_integer" null="false" />
</cfquery>
<!--- ACCESS FACTORY HERE --->
<cfset dog = getDogFactory().getDog().init() />
<cfif qRead.recordcount>
<cfset dog.setID(qRead.id) />
<cfset dog.setBreed(qRead.breed) />
<cfset dog.setWeight(qRead.weight) />
</cfif>
<cfreturn dog />
</cffunction>
Does that make things clearer?
Rich Kroll
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269635
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4