Why not write a decorator method to handle it, so you can do post.delete(),
then have your method troll down the tree and clean up all the related
objects?

I <3 decorators =)

Chris Peterson


On 6/19/09 10:26 AM, "whostheJBoss" <[email protected]> wrote:

> 
> Has anyone here come up with a way (or written a custom method) to use
> cascadeDelete() and specify a list of objects to ignore? (on the way
> "up" and "down")
> 
> My basic issue is this (example):
> 
> I have table of users who can make posts. The posts can have comments.
> The comments can have multiple responses, the responses can have
> ratings, etc
> 
> Basically, lots of relationships between objects.
> 
> The posts are tied to users via onetomany, so multiple posts per user.
> 
> I have a function for a user to delete a specific post. Of course,
> there are all kinds of other things I want to delete when this post is
> deleted (the comments, responses, raitings, etc)
> 
> If I use cascadeDelete() it works... except that it wipes out the user
> object too since it's related to the post. Obviously I don't want to
> delete my user, just the post.
> 
> Writing a custom function to dig down through and find all the
> comments and run delete on each one, then dig down and find the
> responses to the comments and delete each one, and so on seems like an
> awful lot of extra work when cascadeDelete() ALMOST pulls this off.
> 
> I need something like an additional argument to specify objects NOT to
> delete during the cascade. Basically to do something like this:
> 
> Transfer.cascadeDelete(post, "users.user");
> 
> where "users.user" is the object (or comma-delimited list of objects)
> to skip over in the delete process.
> 
> Has anyone else got an elegant solution for this? Thanks!
> 
> > 



--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to