Working environment: OS X 10.6.3, Xcode 3.2.1
Hi! I’m working on a project called Rent-a-Flick. The project has two entities: Movie and Client. Between them there’s a many-to-many relationship.
I have 2 tables: one with the movies and one with the clients. Their content is bound to the proper array controllers(for movie and client).
I want to add a third table in which only the clients that rented a selected movie will appear. I should also be able to add/remove clients from this table. How can I do that without creating duplicates?
The project is open source. I’ll publish it as soon as I make a stable release.
Working environment: OS X 10.6.3, Xcode 3.2.1 Hi! I’m working on a project called
Share
This “third table” already exists implicitly in your Core Data many-to-many relationship.
When you call a method like
[aMovie addClientObject:aClient]on one of your Core Data model objects, the effect of that is to add a row to the movie-client relationship table. Similarly, if you want to remove a client, you would do it using the Core Data accessor method[aMovie removeClientObject:aClient], not by directly manipulating the table.If you have an instance of a
Movieobject, you can see what clients rented that movie simply by referring to theclientsproperty of that object. For example: