Chuck,
Hi John,
On 2014-03-04, 4:14 AM, "John Pollard" wrote:
Chuck,
Ok, will put a trap in the setXXX method and see if that catches it if it happens again.
I am not quite clear on what you mean about checking relationships (plural) to this entity in the model.
My base object is Transaction
My to-one related object is Organisation
Is there a to-many from Organization to Transaction?
A couple. One has a Deny delete rule. The other is a many-many and has a Nullify delete rule, but the target object type, Transaction, is never deleted so these shouldn't come into play.
This relationship does have a Delete Rule of Nullify. I understood this to mean that if the related Organisation is deleted, we will be left pointing to null. That could explain it, though I am certain that the related object was never deleted.
Could something else have cascade deleted it?
I grepped out all my cascade rules in the model plist files and couldn't see any that I could suspect of this crime. If I work out what was triggering it, I will report back on this thread, but for now, I am ok with my workaround, many thanks.
John
I have in any case set it to Deny instead, which I take to mean disallow the deletion of the related object while I am pointing at it.
Yes.
With Nullify delete rules, would the setXXX get called, but the validateXXX not called?
I am not certain. If EOF is removing and nulling relationships during saveChanges(), it may not call the validateXXX methods. Honestly, I forget.
Chuck
Thanks
John
Try the set… method then. Also check the relationships to this entity in the model. Is one set to Nullify? It could be EOF doing this as part of a save.
Chuck
On 2/27/2014, 5:43 AM, "John Pollard" wrote:
Hi List,
I am trying to pin down where a to-one relationship is getting set to null inappropriately.
I added validateMyRelationship() to trap and throw and this is triggered ok when the base object is created / updated.
However, it wasn't called when the relationship was set to null and hence the update proceeded, bypassing my trap.
Does the above scenario ring any bells; why isn't validateMyRelationship() called when I can see the update request to the database follows.
I can't set the relationship to mandatory as in some circumstances null is valid, though it should never change to null after it has been set.
Thanks
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription:
|