Re: Core data one-to-many: how to set relationship for newly added 'many' objects?
Re: Core data one-to-many: how to set relationship for newly added 'many' objects?
- Subject: Re: Core data one-to-many: how to set relationship for newly added 'many' objects?
- From: Jerry Krinock <email@hidden>
- Date: Wed, 22 Oct 2008 17:31:21 -0700
On 2008 Oct, 22, at 13:55, Arthur C. wrote:
A basic question:
I have a Core Data model which has a one-to-many relationship, say
one Department and several Employees.
When an Employee is added using the 'add' button of the standard
interface, how can I set the relationship to the (one) instance of
Department? It means you need access to theDepartment from Employee
- awakeFromInsert.
I don't think so. Getting a reference to one of your objects should
be trivial. Note that -[NSManagedObject
insertNewObjectForEntityForName:inManagedObjectContext] returns the
newly-inserted object.
If you need to post a follow-up, please clarify: Are you working with
Apple's DepartmentsAndEmployees Sample Code project?
_______________________________________________
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