1

I have a core data model like so:

SALES_REP <--->> CUSTOMER <---->> PURCHASE_AGREEMENT <<------->> PRODUCTS

I can get the entity description for the Purchase Agreement and I can get the relationships (toCustomer and hasProducts)

[NSEntityDescription relationshipsByName];

but is it possible to get the Sales_Rep as well or do I have to pull that through the CUSTOMER entity?

Thanks

PruitIgoe
  • 6,166
  • 16
  • 70
  • 137

1 Answers1

0

According to your diagram, SALES_REP isn't directly related to PURCHASE_AGREEMENT, it's only linked via CUSTOMER. That means SALES_REP doesn't know anything about PURCHASE_AGREEMENT on its own. So yes, you'll have to move on to the entity description for CUSTOMER and ask it for its relationshipsByName. I'm not sure what you're trying to do here, but it would be easy to recursively look up relationships on an entity, then its related entities, and their related entities, etc, until you don't find any new ones.

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
  • Thanks Tom, I am duplicating the Purchase Agreement and need to get all the relationships up and down the chain. – PruitIgoe Dec 17 '13 at 17:40