Not understanding these two methods. I can see what they are supposed to do and they appear to be working, but I don't see that they are being called. The book says that we don't care about the add method. The remove method serves the function to set the entity "manager" in the Department table to nil if the employee being removed is the employee set as the manager in the Department table...
The NSLog event is never recorded and a trace put in the method is never hit. So how is this method being used? When I delete a manager the manager entity appears to be set to nil properly, but how?
Also why do we put these methods in Department.m and not Employee.m
Code:
- (void)removeEmployeesObject:(Employee *)value
{
NSLog(@"Dept %@ removing employee %@", [self deptName], [value fullName]);
Employee *manager = [self manager];
if(manager == value){
[self setManager:nil];
}
NSSet *s = [NSSet setWithObjects:value];
[self willChangeValueForKey:@"employees" withSetMutation:NSKeyValueMinusSetMutation usingObjects:s];
[[self primitiveValueForKey:@"employees"] removeObject:value];
[self didChangeValueForKey:@"employees" withSetMutation:NSKeyValueMinusSetMutation usingObjects:s];
}
The NSLog event is never recorded and a trace put in the method is never hit. So how is this method being used? When I delete a manager the manager entity appears to be set to nil properly, but how?
Also why do we put these methods in Department.m and not Employee.m