This may be an obvious question but...should I be maintaining an array
of Contact objects in variables scope as well? (code snippet below)

Muchos gracias,

Stace

<cfcomponent displayname="Affiliate Object" output="false">


        <cffunction name="init" output="false" access="public"
returntype="Affiliate">
                <cfargument name="data" type="struct"
default="#structNew()#" />
                <cfset variables.instance = arguments.data />
                <!--- Array for Contact Objects --->
                <cfset variables.contacts = ArrayNew(1) />
                <cfset variables.requiredFields = "" />
                <cfset variables.missingFields = "" />
                <cfset variables.invalidFields = "" />
                <cfreturn this />
        </cffunction>


        <cffunction name="addContact" access="public" returntype="void"
output="false">
                <cfargument name="contact" type="mysite.model.Contact"
required="yes" />
                <cfset ArrayAppend( variables.contacts,
arguments.contact ) />
        </cffunction>


        <cffunction name="getInstanceMemento" access="public"
returntype="struct" output="false">
                <cfset var x = "" />
                <cfset variables.instance.contacts = ArrayNew(1) />
                <cfloop index="x" from="1" to="#ArrayLen(
variables.contacts )#">
                        <cfset ArrayAppend( variables.instance.contacts,
variables.contacts[x].getMemento() ) />
                </cfloop>
                <cfreturn variables.instance />
        </cffunction>


        <cffunction name="setInstanceMemento" access="public"
returntype="Affiliate" output="false">
                <cfargument name="memento" type="struct" required="yes"
/>
                <cfset var x = "" />
                <cfset variables.instance = arguments.memento />
                <cfloop index="x" from="1" to="#ArrayLen(
variables.instance.contacts )#">
                        <cfset variables.contacts[x].setMemento(
arguments.memento.contacts[x] ) ) />
                </cfloop>
                <cfreturn this />
        </cffunction>

</cfcomponent>




-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED]
Sent: Saturday, December 20, 2003 8:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] memento and composition (w/ arrays)

On Dec 20, 2003, at 4:54 PM, Stacy Young wrote:
> I've got an Affiliate.cfc which contains an array of Contact.cfc
> objects. I'm guessing I could just store an array of contact mementos
> in
> the struct?

Yup

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
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
www.mail-archive.com/[EMAIL PROTECTED]



AVIS IMPORTANT:
-------------------------------
Les informations contenues dans le present document et ses pieces jointes sont 
strictement confidentielles et reservees a l'usage de la (des) personne(s) a qui il 
est adresse. Si vous n'etes pas le destinataire, soyez avise que toute divulgation, 
distribution, copie, ou autre utilisation de ces informations est strictement 
prohibee. Si vous avez recu ce document par erreur, veuillez s'il vous plait 
communiquer immediatement avec l'expediteur et detruire ce document sans en faire de 
copie sous quelque forme.

WARNING:
-------------------------------
The information contained in this document and attachments is confidential and 
intended only for the person(s) named above. If you are not the intended recipient you 
are hereby notified that any disclosure, copying, distribution, or any other use of 
the information is strictly prohibited. If you have received this document by mistake, 
please notify the sender immediately and destroy this document and attachments without 
making any copy of any kind.

----------------------------------------------------------
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 www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to