Re: The mystery of the missing inverse relationship (was: Re: Fun (or not) with NSArrayControllers and CoreData.)

2009-07-31 Thread Quincey Morris
On Jul 31, 2009, at 17:19, Daniel DeCovnick wrote: I can put these in any included .h file, right? I don't have a custom subclass of Folder at all at the moment. I meant as a category of Folder -- which is a "custom subclass" of NSManagedObject in Core Data terminology. So, Folder.h (or wha

The mystery of the missing inverse relationship (was: Re: Fun (or not) with NSArrayControllers and CoreData.)

2009-07-31 Thread Daniel DeCovnick
On Jul 31, 2009, at 3:41 PM, Quincey Morris wrote: Still, it's slightly disconcerting that setting the property doesn't set the inverse relationship. How are you supposed to change it later? I believe it *was* setting the inverse correctly, just not KVO- compliantly. That is, your data m

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Quincey Morris
On Jul 31, 2009, at 15:11, Daniel DeCovnick wrote: That worked! The result was wrong, but making the rootFolder relationship into rootFolders and making it to-many, changing getRootFolder to -(NSArray *)allContainingFolders, and sending everything in that the addAllDescendantsJobsObject: me

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Daniel DeCovnick
On Jul 31, 2009, at 2:26 PM, Quincey Morris wrote: On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote: -(IBAction)newJob:(id)sender { id folder = [self currentFolder]; CCCEJob *newJob = [NSEntityDescription insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext: [self ma

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Quincey Morris
On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote: -(IBAction)newJob:(id)sender { id folder = [self currentFolder]; CCCEJob *newJob = [NSEntityDescription insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext: [self managedObjectContext]]; [folder addJobsObject:n

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Daniel DeCovnick
On Jul 31, 2009, at 11:01 AM, Quincey Morris wrote: On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote: What is selected in FolderTreeController's outline view? Your code above implies that you select a non-root folder prior to adding a new job (to the non-root folder). The "allDescendantsJ

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Quincey Morris
On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote: If I unbind the Content Set of the JobArrayController (so I see all Jobs) adding some extra table columns showing the Folder name and root Folder name, adding and removing Jobs works fine (the data shows up in the table, and the Folder and

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-31 Thread Daniel DeCovnick
Try this: -- Add an "allDescendantJobs" Core Data to-many relationship to the Folder entity in your Core Data model. Set its delete rule to Nullify. -- Add a "rootFolder" Core Data to-one relationship to the Job entity, and make it the inverse of "allDescendantJobs". Set its delete rule

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-29 Thread Quincey Morris
On Jul 29, 2009, at 14:30, Daniel DeCovnick wrote: I'm sorry, you misunderstand. My NSManagedObject subclass Folder, not Job, has the allDescendantsJobs, and the NSTreeController/ NSOutlineView has all Folders where parent==nil as its root objects. There is a one Folder to many Jobs relation

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-29 Thread Daniel DeCovnick
On Jul 29, 2009, at 12:40 PM, Quincey Morris wrote: On Jul 29, 2009, at 11:27, Daniel DeCovnick wrote: I read over the Ensuring KVO compliance docs, and I have to say, I don't think I understand it. At first glance it looks fine to me, but obviously it's not. Do I have to implement mutable

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-29 Thread Quincey Morris
On Jul 29, 2009, at 11:27, Daniel DeCovnick wrote: I read over the Ensuring KVO compliance docs, and I have to say, I don't think I understand it. At first glance it looks fine to me, but obviously it's not. Do I have to implement mutableSet/ ArrayValueForKey: myself, or am I completely on t

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-29 Thread Daniel DeCovnick
On Jul 28, 2009, at 5:23 PM, Quincey Morris wrote: On Jul 28, 2009, at 16:44, Daniel DeCovnick wrote: -(NSSet *)allDescendentsJobs { ... } But I can't bind JobsArrayController's content set to this because "entity Folder does not support Key Value Coding for property 'allDescende

Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-28 Thread Quincey Morris
On Jul 28, 2009, at 16:44, Daniel DeCovnick wrote: -(NSSet *)allDescendentsJobs { ... } But I can't bind JobsArrayController's content set to this because "entity Folder does not support Key Value Coding for property 'allDescendentsJobs'" because, as I understand it, it's read-only*

Fun (or not) with NSArrayControllers and CoreData.

2009-07-28 Thread Daniel DeCovnick
My entities and relationships are set up as follows Folder<<-- children--parent-->Folder and Folder<--folder--jobs-->>Job. My nib has a tree controller for the Folders. This part works fine. If I create an Array Controller for the Jobs (JobsArrayController), and set the Content Set to Folder