• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 14:51:51 -0700

On Fri, Jul 30, 2010 at 2:11 PM, Martin Stanley
<email@hidden> wrote:
> 2- the invalid predicate breaks the NSPredicateEditor. My NSPredicateEditorRowTemplate subclass populates its popup button dynamically based on the current contents of an NSArrayController bound to the entity in question (e.g., Project). When it tries to match the popup to this predicate it complains because there is no longer an entry matching the deleted object's name.
>
> However, following your last suggestion, I think the following should work:
> - when a SmartGroup is created, register an observer on its predicate attribute.
> - then whenever the predicate is changed:
>        - parse the predicate to find all of the objects mentioned (by name), and
>        - create a bi-directional reference between each object and this SmartGroup object
> - then when attempting to delete the object (e.g. a Project) inform the user and, if given the go-ahead, clean up all predicates which reference the object before asking Core Data to delete the object.

I think you're going about this backwards. Your predicate should
already be modeled in the document (by a SmartGroup entity or a
collection of related entities) and the predicate editor's delegate
should be the controller responsible for converting between the
predicate editor's representation and your model representation. This
would be evidence of a good MVC design.

--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

  • Follow-Ups:
    • Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
      • From: Martin Stanley <email@hidden>
References: 
 >Re: Cocoa-dev Digest, Vol 7, Issue 777 (From: Martin Stanley <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 7, Issue 777 (From: Keary Suska <email@hidden>)
 >Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships? (From: Martin Stanley <email@hidden>)

  • Prev by Date: Re: Calling Matlab from Cocoa
  • Next by Date: Determine encoding of file
  • Previous by thread: Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
  • Next by thread: Re: Intercepting deletion of NSManagedObjects or how to handle deletion in non-explicit relationships?
  • Index(es):
    • Date
    • Thread