Re: Core Data: Custom to-many relationship setter not being invoked
Re: Core Data: Custom to-many relationship setter not being invoked
- Subject: Re: Core Data: Custom to-many relationship setter not being invoked
- From: Ken Tabb <email@hidden>
- Date: Tue, 23 Feb 2010 09:20:24 +0000
Adding is via a button going to an Employee array controller's -add.
In the interface there are 2 array controllers (1 for Departments, 1
for Employees). The Employees controller is set to use the selection
in the Departments controller (i.e. showing the subset belonging to
the selected dept).
Adding and deleting Departments and Employees is fine (everything gets
hooked up / added / deleted properly), and if I look in the XML Core
Data store, all is well. It's just my custom accessors (the 4
mentioned below) don't get used, whereas -setEmployees does.
Do you reckon it's because the adding is happening from the Employee
side of things rather than the Department side of things? Shouldn't
both sides have their accessor methods called (thanks to the inverse
relationship)?
I can't believe it's relevant, but the Department's 'employees'
relationship is mandatory, as is the inverse relationship.
Weird isn't it :)
Ken
On 23 Feb 2010, at 2:34, Quincey Morris wrote:
On Feb 22, 2010, at 15:54, Ken Tabb wrote:
Yep I implemented all 4, as per the Design -> Data Model -> Copy to
clipboard template, i.e.
- (void)addEmployeesObject:(Employee *)value;
- (void)removeEmployeesObject:(Employee *)value;
- (void)addEmployees:(NSSet *)value;
- (void)removeEmployees:(NSSet *)value;
However if I implement -setEmployees as per Jerry's e-mail (and
seemingly contravening the advice in the Core Data Programming
Guide), then it works like a charm :-/
There's something else going here, though it isn't clear what. One
thing you haven't said is *how* you're adding employees. Could you
show the code that does this?
_______________________________________________
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:
@herts.ac.uk
This email sent to email@hidden
- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Developer - Health & Human Sciences
Machine Vision & Neural Network researcher - School of Computer Science
University of Hertfordshire, UK
_______________________________________________
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