I have two objects, a Trip
and a Place
. A Trip
represents a journey from one Place
to another Place
, ie. a Trip
needs a fromPlace
and a toPlace
. So, this is a 1-to-2 relationship, but I need to know which is the "from" and which is the "to". I am not sure how to model this in Core Data. I have created two entities (Trip, Place
), and now I want to setup the relationship(s) so I have a fromPlace
and a toPlace
. Do I need to add an extra field on the Place entity called isFrom
, or similar?
If this was in a database, I would just have a id column on the Place
table, and then two columns in the Trip
table - fromPlaceId
and toPlaceId
. How do I achieve something similar in Core Data?