Reputation: 20238
I have:
AT <<-->> ST <<-->> CT <-->> D
I want to get all AT entities that are related to D.
Is it possible? If so, how would I go about getting them?
Thank you
Upvotes: 0
Views: 93
Reputation: 119041
Assuming that you have an instance of D
, called d
, and that each object has a sensibly named relationship, try:
[d.ct.st valueForKeyPath:@"@distinctUnionOfObjects.at];
This navigates the initial single relationship to CT
, then gets the set of ST
object, asks each for its AT
objects and generates the distinct collection of the result.
Upvotes: 5