Re: Problem with relationships in Core Data
Re: Problem with relationships in Core Data
- Subject: Re: Problem with relationships in Core Data
- From: Remco Poelstra <email@hidden>
- Date: Tue, 26 Sep 2006 21:53:14 +0200
I'm very sorry for my unclear question.
Let me try to rephrase my question.
I have two entities: actually called 'onderdeel' (A in my previous
mails, 'component' in english) and datasheet (B). They have a
relationship to each other called datasheet and onderdeel. I made a
screenshot of it: http://beryllium.net/~remco/data_model.png
In the GUI there is a tableview which shows the instances of the
'onderdeel' entity. When I select a row in that table, another table
shows the datasheets associated with that component, ie the datasheet
relationship of the 'onderdeel' instance. When I now send a remove
message to the ArrayController managing the datasheets, the
relationship of the component ('onderdeel') instance is updated to
reflect the fact that I want to remove the datasheet from its
relationship. But the object remains in the object graph with a
relationship to the component, which I do not expect. The datasheet
isn't shown in the tableview anymore, which is logical, because the
component doesn't have a relationship to the datasheet anymore. The
fact that the datasheet instance remains in the objectgraph isn't a
problem, only that its relationship to the 'onderdeel' instance is
maintained.
I made a screenshot of my app, in the hope that it will clarify all a
little bit: http://beryllium.net/~remco/screenshot.png
Thanks very much for your help and patience,
Remco Poelstra
Op 26-sep-2006, om 19:41 heeft mmalc crawford het volgende geschreven:
On Sep 26, 2006, at 7:30 AM, Remco Poelstra wrote:
I've a problem with the relationships in Core Data.
I've two entities A and B. The both link in an inverse
relationship to
each other. I've two array controllers, one which manages all A
entities,
the other which manages the B entities which are in the relation
from A to
B.
When send a remove message to the B controller, the relation from
A to B
is updated to reflect the fact that the selected B entity is
removed. The
problem now is that the B entity still keeps it's reference to
entity A.
Shouldn't the arraycontroller update that relationship? Or do I've
to do
that myself?
Please use the correct terminology, it makes it easier to try to
follow what you're describing (see <http://lists.apple.com/archives/
Cocoa-dev/2006/Sep/msg00962.html>).
It's not clear from your description whether the actual
relationship is incorrect or if one of the array controllers is
displaying something you don't expect?
Core Data normally manages relationships and inverse relationships
for you -- see <http://developer.apple.com/documentation/Cocoa/
Conceptual/CoreData/Articles/cdUsingMOs.html#//apple_ref/doc/uid/
TP40001652-207874>. Have you defined custom accessor methods for
your relationships?
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden