Re: preventing orphan records - where is best place
Re: preventing orphan records - where is best place
- Subject: Re: preventing orphan records - where is best place
- From: Kieran Kelleher <email@hidden>
- Date: Wed, 29 Oct 2008 18:51:59 -0400
Never mind :-)
.... found the WOnder solution .... should have never doubted that
WOnder did not have an easy way to facilitate this requirement ......
the pictures say it all ...... "mightDelete" .... I love it - what a
great method name :-)
On Oct 29, 2008, at 6:15 PM, Kieran Kelleher wrote:
I have a scenario where I have EO's in many-to-many .... A <<-->> B.
The delete rule is nullify when A is deleted. A is the important EO
and generally one A is related to a whole lot of B's.
Now if the B was only related to the A being deleted, then those
related B's should be deleted, as if we were cascade deleting, and
not delete any B's that are related to other A's should not be
deleted.
Now what I did was use the ERXEnterpriseObject#willDelete()
EOTransition method to grab the related B's as immutable clone and
iterate thru them, however by the time I get to willDelete the
related B's relationship are already nullified and thus the
relationship returns an empty array and the B orphans are already in
the wild.
For now I am over-riding ERXGenericRecord#delete() and doing it
there after super.delete(), but I really wanted a more robust
solution that will catch the future orphans when the more standard
editingContext.deleteObject(EO o) is used.
Any suggestions?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden