Created
July 20, 2011 21:09
-
-
Save thekarladam/1095943 to your computer and use it in GitHub Desktop.
[A, A->B, A->C] => {A & B} & {A & C}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSManagedObject *itemA = [NSEntityDescription insertNewObjectForEntityForName:@"Group" inManagedObjectContext:self.managedObjectContext]; | |
NSManagedObject *itemB = [NSEntityDescription insertNewObjectForEntityForName:@"Subgroup" inManagedObjectContext:self.managedObjectContext]; | |
NSManagedObject *itemC = [NSEntityDescription insertNewObjectForEntityForName:@"Folder" inManagedObjectContext:self.managedObjectContext]; | |
NSFetchRequest *aAndBFetch = [[NSFetchRequest alloc] initWithEntityName:@"Group"]; | |
NSFetchRequest *aAndCFetch = [[NSFetchRequest alloc] initWithEntityName:@"Group"]; | |
[aAndBFetch setIncludesSubentities:YES]; | |
[aAndCFetch setIncludesSubentities:YES]; | |
[aAndBFetch setPredicate:[NSPredicate predicateWithFormat:@"entity.name == \"Group\" OR entity.name == \"Subgroup\""]]; | |
[aAndCFetch setPredicate:[NSPredicate predicateWithFormat:@"entity.name == \"Group\" OR entity.name == \"Folder\""]]; | |
NSArray *aAndB = [self.managedObjectContext executeFetchRequest:aAndBFetch error:nil]; | |
NSArray *aAndC = [self.managedObjectContext executeFetchRequest:aAndCFetch error:nil]; | |
NSLog(@"aAndB: %@", aAndB); | |
NSLog(@"aAndC: %@", aAndC); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment