• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Polymorphic relationship and migration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Polymorphic relationship and migration


  • Subject: Re: Polymorphic relationship and migration
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 30 Nov 2009 15:36:19 -0800

On Nov 30, 2009, at 14:56, Yi Lin wrote:

> 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.

I believe "ShapeToShape" *is* the correct mapping. Are you saying it doesn't work, or just that you don't think it will work?

My earlier point is that there *are* instances of entity "Shape" -- in the sense that there are instances that are a kind of Shape, even though their actual class might be Triangle or Square. This is analogous to the difference between the 'isKindOfClass:' and 'isMemberOfClass:' methods in Cocoa, and the mapping uses a "kind of" test, not a "member of" test.

I have been successful with just such a mapping in the past. I had a tree structure, so the abstract Node entity had "parent" and "children" relationships. Using a NodeToNode mapping migrated the "children" relationship properly, even the the children were actually of subentities of Node.

Note that using NodeToNode did *not* mean that the objects were changed to entity Node on migration. They stayed as whatever they were supposed to be.


_______________________________________________

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

References: 
 >Polymorphic relationship and migration (From: Yi Lin <email@hidden>)
 >Re: Polymorphic relationship and migration (From: Quincey Morris <email@hidden>)
 >Re: Polymorphic relationship and migration (From: Yi Lin <email@hidden>)

  • Prev by Date: Re: Button width should accomodate localized string
  • Next by Date: Re: Keyword @defs
  • Previous by thread: Re: Polymorphic relationship and migration
  • Next by thread: DADiskMount usage
  • Index(es):
    • Date
    • Thread