Setting Core Data attribute values to related entity attribute values
Setting Core Data attribute values to related entity attribute values
- Subject: Setting Core Data attribute values to related entity attribute values
- From: Jamie Phelps <email@hidden>
- Date: Wed, 16 Jul 2008 11:12:47 -0500
I have a Core Data entity in a Master-Detail view. In the detail view,
I have a button that is bound to the createFoo: method of the selected
object where Foo is the class name of the related entity. What I want
to do is use this button to create a Foo and set its relationship
programmatically.
I have found the section on creating NSManagedObjects in the Core Data
Programming Guide and understand the NSMutableSet procedure of
creating the new objects.
In my awakeFromInsert: method for the Foo class, I want to set
attribute values based on the related entity. If it's null, I have
some defaults, but if the relationship is present, I want to set some
values equal to the corresponding attribute in the related entity as
defaults.
Is awakeFromInsert: the best place to do this, or should I create
another method to set those values based on the related entity?
Thanks for the help.
Jamie
_______________________________________________
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