Reputation: 22946
I have the following CoreData model: [Phone] <<--->> [Forwarding] <--->> [Number].
How do I build up a query that fetches a list of unique Numbers that are used by a Phone (so indirectly via its Forwardings)?
Upvotes: 0
Views: 410
Reputation: 539685
Create a fetch request on the "Number" entity and add the predicate
[NSPredicate predicateWithFormat@"ANY forwarding.phones == %@", thePhone]
to the fetch request (assuming that the to-one relationship from "Number" to "Forwarding" is called "forwarding", and the to-many relationship from "Forwarding" to "Phone" is called "phones").
Upvotes: 3