Yeah, what he said.

Paul Kenney
WebMaster, CorporateWarriors.com
916-663-1963


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Sean A Corfield
Sent: Monday, December 22, 2003 10:33 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] memento and composition (w/ arrays)


On Dec 22, 2003, at 9:13 AM, Paul Kenney wrote:
> The simplest way to do this might be to simply create a Contact object  
> for
> each instance indicated in the memento:
>
>    <cfset contact = CreateObject("component", "mysite.model.Contact")>
>    <cfset contact.setMemento(arguments.memento.contacts[x])>
>    <cfset variables.contacts[x] = contact>

Make sure you create a new instance for each array element (rather than  
try to create one instance and assign to every array element - they'd  
all share the same instance!). You could write:

        <cfset variables.contacts[x] =  
createObject("component","mysite.model.Contact").setMemento(arguments.me 
mento.contacts[x]) />

to avoid the temporary variable (which must be declared at the top of  
the function with 'var').

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]



----------------------------------------------------------
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