I'm trying to play nice with OOP and CFCs and using init methods to start them 
up but am running into a crazy problem that must have a simple fix.

I instantiate the cfc in the application scope:
<cfset Application.cartCFC = createObject("component", 
"cart").init(application.ds)>

In the init method I have the following:
<cfcomponent hint="I handle all cart interaction." output="false">
        <cffunction name="init" access="public" output="false" 
returntype="cart">
                <cfargument name="ds" required="true" type="string">
                <cfscript>
                        variables.ds=arguments.ds;
                </cfscript>
                <cfreturn this>
        </cffunction>

Then when I try to use "variables.ds" in another method call, it says that 
variables.ds doesn't exist even though when I set a breakpoint in the debugger 
right before that variable is called, it is there. What am I missing?

<cffunction name="CalculateCartLinePricing" access="public" 
displayname="Calculate Line Item Price" hint="I calculate the line item price 
and cost in a shopping cart." output="false" returntype="Struct">
                <cfargument default="1" name="CartDetail_Pk" required="true" 
type="Numeric">
                
                <cfstoredproc procedure="pr_getCartLineTotals" 
datasource="#variables.ds#"> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308422
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to