zumzum
zumzum

Reputation: 20238

Core Data query on iOS

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

Answers (1)

Wain
Wain

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

Related Questions