Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-27 Thread Chris Hanson
On Sep 24, 2008, at 3:56 PM, Quincey Morris wrote: IAC, it's not clear why you need to use setPrimitiveValue: at all. Why not something like: - (void)setChildren:(NSSet*)value_ { [[self mutableSetValueForKey:@"children"] removeAllObjects]; [[sel

re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Ben Trumbull
Sean, Jon, The documentation is correct for 10.4. On 10.5, things are more forgiving, and you can call -setPrimitiveValue:forKey: with a public set. We won't use that object, but we will use its contents. It does no inverse maintenance, so unless it's part of the public setter for the

Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Quincey Morris
On Sep 24, 2008, at 17:30, Sean McBride wrote: Surely their example would not screw up inverse relationships, since they also recommend one always have inverses... I guess [self primitiveChildren] could be some kind of proxy instead of a plain set, which might explain it. That would also exp

Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Sean McBride
On 9/24/08 5:01 PM, Quincey Morris said: >> - (void)setChildren:(NSSet *)value_ >> { >> [self willChangeValueForKey:@"children" >>withSetMutation:NSKeyValueSetSetMutation >>usingObjects:value_]; >> [[self primitiveChildren] setSet:value]; >> [self didChangeValueForKey:@"children" >>

Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Quincey Morris
On Sep 24, 2008, at 16:34, Sean McBride wrote: - (void)setChildren:(NSSet *)value_ { [self willChangeValueForKey:@"children" withSetMutation:NSKeyValueSetSetMutation usingObjects:value_]; [[self primitiveChildren] setSet:value]; [self didChangeValueForKey:@"children" withSetMutation:

Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Sean McBride
On 9/24/08 3:56 PM, Quincey Morris said: >> Is that wrong? > >I think so. Your "else" statement does what the documentation tells >you not to do. Indeed. >IAC, it's not clear why you need to use setPrimitiveValue: at all. Thank you for your fresh perspective. That did not occur to me, no doubt

Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Quincey Morris
On Sep 24, 2008, at 12:34, Sean McBride wrote: First they state: "If you try to set a to-many relationship to a new NSMutableSet object, it will (eventually) fail." Eventually?! What does that even mean? Will it fail later during - [NSManagedObjectContext save:]? When an managed object is t

setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Sean McBride
Hi all, Apple's documentation[1] on -setPrimitiveValue:forKey: is vague in two ways when using it to manage to-many relationships. First they state: "If you try to set a to-many relationship to a new NSMutableSet object, it will (eventually) fail." Eventually?! What does that even mean? Will it