Re: Polymorphic relationship and migration
Re: Polymorphic relationship and migration
- Subject: Re: Polymorphic relationship and migration
- From: Yi Lin <email@hidden>
- Date: Mon, 30 Nov 2009 14:56:15 -0800
Quincey,
Thanks for the response. Shape is just a made-up example, but we can
say the entity that contains shape is Diagram for the purpose of
discussion. I am not sure what the mapping "DiagramToShape" would do.
Here's my problem in more concrete terms.
Let's say I have the entity mapping "DiagramToDiagram". And one of the
property mappings is "shape". In the Relationship Mapping panel (the
third column in the mapping model GUI), I set the KeyPath to
"$source.shape". The question is what to put in the Mapping Name
field. If I put ShapeToShape, then the shape property will not be set
because there are no instances of Shape. If I put TriangleToTriangle,
then only shapes that are Triangles will be migrated. There is no
value I can put in this field that will set the "shape" property
properly for all concrete subclasses of Shape.
Yi
On Nov 29, 2009, at 3:16 AM, Quincey Morris wrote:
On Nov 27, 2009, at 17:14, Yi Lin wrote:
For example, if I have a relationship called "shape" that refers to
the Shape abstract entity, with concrete classes Triangle, Square,
etc. In the mapping model, there's no sensible setting for the
Mapping Name field of "shape". If I set the Mapping Name to
TriangleToTriangle, then Square relationships will not be set. And
if I set the Mapping Name to "Shape", than the relationship would
not be set at all because there are no concrete instances of Shape.
If the relationship "shape" is defined to be to a Shape entity, it
seems that the correct mapping would be SomethingToShape.
("Something" is the entity from which the "shape" relationship
emanates, but you didn't say what entity that was.) Even though
there aren't any concrete instances of Shape, the actual instances
(Triangle, Square, etc) *are* also Shape objects.
Perhaps the confusion arises because Leopard Core Data doesn't
properly create the mappings for migrating abstract entities. (I
don't know if this is fixed in Snow Leopard, but I suspect not.) If
that's the problem, then adding the missing mapping should give you
a usable mapping model.
Or have I missed your point?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden