As i recall, objects can't be duplicated. So to me, either you could
reinstantiate the promo object within the session obj and populate the
values from the application scoped object, or you could just get the memento
and leave it as a struct in the session scoped object. I might not know
something, but that's how i'd do it.

If we could duplicate objects, maybe your scenario could work, but it seems
to me like you'd need a unique copy in the cart.

Now i'm going to take a walk!

:) nando

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Ken Dunnington
Sent: Monday, November 22, 2004 9:09 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Strange problem with getter


I've encountered a really puzzling problem that I'm really hoping
someone can take a look at and say, "Oh, you forgot a semicolon" or
something. :)

I have a small transfer object CFC that I'm storing in application
scope. It's used for holding application-wide promotional code
details, and all it has is getters/setters for it's 4 properties and a
getMemento() function. This is for an e-commerce application, so when
the user adds a product to his cart that has a promo code associated
with it, the promo object is added to the cart alongside the product.
Originally, I did this by just assigning item.promo =
application.promo. This worked fine in testing, and it was working in
production at first, but then I started getting this error:

 Element INSTANCE.AMOUNT is undefined in VARIABLES. <br>The error
occurred on line 42.

Line 42 is the beginning of my getAmount function, which looks like this:

        <cffunction name="getAmount" returnType="numeric" output="no"
access="public">
                <cfreturn variables.instance.amount />
        </cffunction>

Obviously not rocket science. Anyway, it occurred to me that this may
be a shared scope issue, so I changed the code that adds the item to
the cart to use StructCopy(application.promo) but I'm still getting
the error (and in fact, now I get it locally as well!)

I can see I'm digging my hole deeper and deeper here :) So my question
is, how do you get a CFC that lives in application scope into a
session scoped structure? The promo CFC is read-only except for
admins, which can update it via a web page (which rarely occurs.)
Should I use Duplicate()? That seems like overkill. Should I be
locking every access to this object? Even though it's the same data
for everybody? Should I just use a structure and not a CFC? Or should
I take a walk and clear my head so I can see the obvious mistake I'm
probably making here? :)

Thanks,
Ken
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at 
[EMAIL PROTECTED]

Reply via email to