Re: CoreData relationship/KVC question
Re: CoreData relationship/KVC question
- Subject: Re: CoreData relationship/KVC question
- From: Jean-Nicolas Jolivet <email@hidden>
- Date: Fri, 30 Jan 2009 16:26:36 -0500
Perhaps my question wasn't clear hehe...
What I wanted to know, more or less, is (following my previous
Employee/Department example) can I add employees to a Department using
KVC
For example
CoreData generates the following method to add an employee object to a
deparment: addEmployee:(NSManagedObject *)value
Using that accessor I know I can do the following:
[aDepartment addEmployeesObject:anEmployee];
How would I do that using KVC ? My point is... I don't want to
subclass NSManagedObject for all my entities and I don't want to
create a category with ALL the possible accessors...
Can I do this?
[aDepartment setValue:anEmployee forKey:@"employees"];
CoreData (in this example) would also generate the following:
addEmployees:(NSSet *)values
To add multiple employees to a department.... once again, how would I
do that using KVC??
Hopefully it's clearer now! Let me know if you still have difficulty
understanding my question, I'll do my best to explain! :)
On 30-Jan-09, at 4:16 PM, Steve Steinitz wrote:
Hi Jean-Nicolas
I may not grasp your question but
are relationship also KVC?
You can do KVC stuff with relationships like
employees = [department valueForKey: @"employees"];
but I doubt that's what you mean.
and, will CoreData aumatically call the correct method depending on
the type of the "value" I'm setting (either an NSSet or an
NSManagedObject) ?
I don't think so. But don't take my word for it. I look forward to
replies from people who understand your question more clearly.
Cheers,
Steve
Jean-Nicolas Jolivet
email@hidden
http://www.silverscripting.com
_______________________________________________
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