Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
- Subject: Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
- From: Kyle Sluder <email@hidden>
- Date: Fri, 30 Jul 2010 21:54:37 -0700
On Fri, Jul 30, 2010 at 7:37 PM, Martin Stanley
<email@hidden> wrote:
> Perhaps you know something about NSPredicateEditor that I don't, but I think it does not use its delegate in the way you envision. To quote from the docs:
You are correct. I was thinking of NSRuleEditor.
> However, my subclass of NSPredicateEditor overrides the objectValue method (to catch errors such as the one I described earlier). It would be possible to parse the predicate and create back-pointers at this point. This is called every time the predicate is changed. Would this be a better approach?
Yes, I would expect that whatever controller is setting and retrieving
the objectValue from the predicate editor would be doing the necessary
communication with the model to keep the view and model in a
consistent state. The best thing to do might be to use this
opportunity to convert from NSPredicate instances (for the predicate
editor's objectValue) to collections of managed objects that model the
predicate. Then Core Data delete rules and validation will take care
of all the consistency, rather than forcing this logic into the
controller or view.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden