Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant
On Feb 11, 2009, at 7:37 PM, Luke Evans wrote: ... and it's cold comfort to find that the behaviour is exactly the same. So, at least there isn't 'another' problem :-) Well, actually, I realize now that my statement was ambiguous. I meant that asking via -valueForKey: and providing the

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans
[[self valueForKeyPath:@"parent.elements"] allObjects] ... this should do the same thing with the expected result. If it does not, there is another problem with your code. ... and it's cold comfort to find that the behaviour is exactly the same. So, at least there isn't 'another' problem

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant
On Feb 11, 2009, at 5:38 PM, Luke Evans wrote: Clearly, you wouldn't even notice the switcheroo if you were driving the relationship via a more generic collection-like interface (e.g. like using -count, using fast enumeration or other things that apply equally well to a range of concrete co

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans
Hmmm ... I do not have an answer for this. If nobody else can offer any insight, I'd file a bug. In fact, I'd file it anyway because this random substitution should not happen. Yeah, I guess someone with deep knowledge of the states that a Core Data to-many relationship can be in throughou

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant
On Feb 11, 2009, at 5:09 PM, Luke Evans wrote: Anyway, like you, I can't see how having a read-only flag on the wrapping property in my NSManagedObject subclass is going to affect how a to-many relationship is internally represented within NSManagedObject. Moreover, I reset the declaration o

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans
The documentation (Core Data Programming Guide --> Managed Object Accessor Methods --> Custom To-Many Relationship Accessor Methods) spells out all the stipulations for custom to-many accessors and the code example is: @property NSSet *employees; ... without the readonly flag. I would not expe

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant
On Wed, Feb 11, 2009 at 3:32 PM, Luke Evans wrote: > Indeed it is defined in a subclass of NSManagedObject as: > > @property(readonly, retain) NSSet *elements; > > It is read only as writing is done via KVC patterned write accessors (i.e. > addElementsObject, removeElementsObject). > > The implem

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans
On 11-Feb-09, at 12:16 PM, I. Savant wrote: How? What does this declaration look like in your classes? I assume you have at least one custom subclass of NSManagedObject specified (for your "Element" entity), based on the code example you gave, but it's important to let us know *how* this is de

Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant
On Wed, Feb 11, 2009 at 2:48 PM, Luke Evans wrote: > The parent MO is defined with an 'elements' property (nominally an NSSet). How? What does this declaration look like in your classes? I assume you have at least one custom subclass of NSManagedObject specified (for your "Element" entity), ba

Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans
I've just found out that some code that seemed to be working fine doesn't do so under all circumstances. I have a to-many relationship (called 'elements') in a managed object ('parent'). In one spot in my code, there is a need to obtain and present all of the elements of the parent managed