That’s it exactly!

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Shuck
Sent: Wednesday, April 19, 2006 2:36 PM
To: [email protected]
Subject: Re: [Reactor For CF] New Commit committed (UPDATED!)

 

> <cfset user.removeAddress().delete() />
> <cfset user.save() />

I am sure this is obvious to some, but can I confirm exactly what that is doing?  I think I it is doing the following:

- remove the relationship from the user to the address
- delete the address from the database
- save the user with the newly removed relationship

Is that correct?  If so that is pretty dang clean.

~Dave

On 4/19/06, Doug Hughes <[EMAIL PROTECTED]> wrote:

> OK. Is there any thought of adding cascading delete so that the first
> code *would* also delete all related sub-objects?

I discussed this a bit last night, but for now I'm going to hold off on
this.  I don't see an urgent need for it.

> Yes, please. Then I can do this:

> <cfset user.removeAddress().delete() />
> <cfset user.save() />

Done and will be committed shortly.

Doug

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf
Of Sean Corfield
Sent: Wednesday, April 19, 2006 1:45 PM
To: [email protected]
Subject: Re: [Reactor For CF] New Commit committed (UPDATED!)

On 4/19/06, Doug Hughes <[EMAIL PROTECTED] > wrote:
> The following code will delete the user but not the address.
>
> <cfset user.delete() />
>
> The following code will cause a dbms-specific constraint error to be
thrown.
> You can't delete the user's address.
>
> <cfset user.getAddress().delete() />

OK. Is there any thought of adding cascading delete so that the first
code *would* also delete all related sub-objects?

> <cfset address = user.getAddress() />
> <cfset user.removeAddress() />
> <cfset user.save() />
> <cfset address.delete() />
>
> (Should removeAddress return the address that was removed?  Akin to a
pop()
> method?)

Yes, please. Then I can do this:

<cfset user.removeAddress().delete() />
<cfset user.save() />
--
Sean A Corfield -- http://corfield.org/
Got frameworks?

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



-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/





-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/




--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com
www.worldwildweb.biz -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/

-- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/

Reply via email to