• 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: Core Data Implementation question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data Implementation question


  • Subject: Re: Core Data Implementation question
  • From: Charilaos Skiadas <email@hidden>
  • Date: Wed, 20 Jul 2005 12:25:09 -0500

On Jul 20, 2005, at 12:03 PM, Marcus S. Zarra wrote:

I am trying to figure out the best way to approach this issue with Core
Data.


I have a parent object that has a to-many relationship with a child object.
The child has a to-one relationship with the parent.


Parent <-->> Child

Adding new children works correctly and the GUI (which displays the children
in a table) works perfectly.


The problem comes in with a couple of attributes in the parent. The parent
has a couple of values that are changed based on the children. The children
are added progammatically and I need a way to notify any observers that the
parent attributes have changed when I add the child. I have tried doing the
following:

Are the values only changing when a child is added? In that case, you should I think be able to just use the "derived value" approach described in
http://developer.apple.com/documentation/Cocoa/Conceptual/ NSPersistentDocumentTutorial/03_CustomClass/ chapter_4_section_3.html#//apple_ref/doc/uid/TP40001799-CH219- DontLinkElementID_14


and the the "children" key as the key in the "initialize" method that triggers the notification.

If on the other hand the attributes depend on attributes in the children themselves, then I am not too sure what the best way to accomplish that is, but I sure would like to know.
[parent willChangeValueForKey:@"xxx"];
//add child
[parent didChangeValueForKey:@"xxx"];
but this seems to mess up the actual update of the child.

Does anyone know of a cleaner way to get this to work? Note that the parent
attribute "xxx" is a calculated value in the parent object and not a value
stored in the core data repository.


Thanks for any insight.

Marcus S. Zarra

Haris


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Core Data Implementation question
      • From: "Marcus S. Zarra" <email@hidden>
References: 
 >Core Data Implementation question (From: "Marcus S. Zarra" <email@hidden>)

  • Prev by Date: Re: What am I doing wrong in my drag loop? Dragging jumps all over the place.
  • Next by Date: Re: Adding 30 minutes to an NSDate
  • Previous by thread: Core Data Implementation question
  • Next by thread: Re: Core Data Implementation question
  • Index(es):
    • Date
    • Thread