Hi John,

Could be you did it in “validateForSave()” You shouldn’t be changing values 
there, only throwing validation errors.

Grab the snake by its tail, start pulling, keep doing it until you find the 
head.

Namely, put your break point not in your “validateRelationship” method but more 
directly in your “updateRelationship” method which should be in your abstract 
“under bar” class for the EO. That is much closer to the scene of the crime. 
Try that and report back.

Oh, notice how the “validateRelationship” and “validateAttribute” methods 
always return an object? That is the potentially coerced object that EOF will 
use to update the EO. In contrast, “validateForSave()” is a void… That is a 
subtle clue to never do object manipulation in “validateForSave()”

Of course I’m stabbing in the dark here but “grabbing the tail of the snake” 
will make whatever it is clear.

May the 4th be with you.
AARON ROSENZWEIG / Chat 'n Bike
e:  [email protected]  t:  (301) 956-2319             
        

On Feb 27, 2014, at 8:43 AM, John Pollard <[email protected]> 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.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to