• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Coredata Abstract Relations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coredata Abstract Relations


  • Subject: Re: Coredata Abstract Relations
  • From: Sammi Williams <email@hidden>
  • Date: Mon, 27 Jun 2005 01:26:27 +1200

Regarding implementing a custom accessor:


Given that you already have this information, an easy way would be to implement a custom class for the Bank entity that returns a union of the bankTransaction relationship and the value for the key path persons.personTransactions (or however you've named the relationships).



Okay, this makes sense - is it not possible to do it with a fetched property? Or is this basically a fetched property implemented with custom logic?



Great, I think this is mosty sorted.

I'm curious, now I also depend on 'persons.account' from within the Bank entity to update my 'allTransactions' union of all transactions accessor - how can i do this with triggerChangeNotificationsForDependantKeys ? I tried his naively

//in initialize
NSArray *keys = [NSArray arrayWithObjects: @"persons", @"account", @"persons.account", nil];
[self setKeys:keys triggerChangeNotificationsForDependentKey:@"allTransactions"];


Thanks for any advice how to hook up this change notification!!!

Anyone interested in the allTransactions code, here it is:

- (NSSet*) allTransactions {
NSMutableSet* all = [NSMutableSet setWithSet:[self valueForKeyPath:@"account"]];
NSSet *persons = [self valueForKeyPath:@"persons"];
id person, iter = [persons objectEnumerator];


    while (person = [iter nextObject]) {
        [all unionSet:[person valueForKeyPath:@"account"]];
    }

    return all;
}

I'm curious if there is any way to make this better by using @unionOfSets or something rather than a while loop - I tried it but got lots of problems and it didn't work at all.

Sammi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Coredata Abstract Relations (From: Sammi Williams <email@hidden>)
 >Re: Coredata Abstract Relations (From: mmalcolm crawford <email@hidden>)
 >Re: Coredata Abstract Relations (From: Sammi Williams <email@hidden>)

  • Prev by Date: Re: Implementing Safari's incomplete download behavior
  • Next by Date: Using + as a command key for a NSMenuItem
  • Previous by thread: Re: Coredata Abstract Relations
  • Next by thread: Re: NSFileManager - getting list of "safe" files/folders [update]
  • Index(es):
    • Date
    • Thread