Yes, the relationship is bi-directional. As I was verifying the inverse relationships, I got to thinking about what I’m doing and realized I need to provide a bit more information.
I have three entities: List, Tag, and Verse. List and Tag each have an optional, to-many relationship to Verse. Verse has two optional, to-many, inverse relationships to List and Tag. The idea is a verse can be assigned to zero or more lists or tags, so a list or tag can have zero or more verses.
In the code I showed above, I left out the part that defined target_array_controller. It is:
- (BOOL) tableView: (NSTableView *) tableView acceptDrop: (id <NSDraggingInfo>) info
row: (NSInteger) row dropOperation: (NSTableViewDropOperation) dropOperation
NSArrayController* target_array_controller = [tableView isEqualTo: lists_table_view] ? lists_array_controller : tags_array_controller;
Depending on which table view is the drop target, I use the corresponding array controller to access the appropriate collection of objects to find the specific one that the verse was dropped on, hence
target_verses in the posted code.
I obviously didn’t think this approach would be a problem, but now that I think about it, I’m not so sure. Does anyone reading this see any potential or real problems?