• 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
removeObjectFromBothSidesOfRelationshipWithKey() question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

removeObjectFromBothSidesOfRelationshipWithKey() question


  • Subject: removeObjectFromBothSidesOfRelationshipWithKey() question
  • From: "Ricardo J. Parada" <email@hidden>
  • Date: Tue, 27 Oct 2009 19:14:23 -0400


Hi,

Let's say you have to-many relationship between two entities:  Order <-->> OrderItem.  The to-many relationship is called "items".
The items to-many is flagged to indicate that the Order owns the destination OrderItem.

Test #1:  Create an Order and OrderItem and insert both into an editing context.  Then add the item to the order using order.addObjectToBothSidesOfRelationshipWithKey(item, "items").  Then IremoveObjectFromBothSidesOfRelationshipWithKey(item, "items") to remove the item.  Then save the editing context.

Result:   EOF attempts to save the orphan item.
Expected Result:  EOF will not attempt to save the orphan item because it was removed from a to-many where the parent owns the destination.

Test #2: Fetch an existing order with one item from the database.  Then order.removeObjectFromBothSidesOfRelationshipWithKey(item, "items".  Save the editing context.  

Result:  EOF will delete the orphan item from the database.

Is this how it's supposed to work?

Thanks,
Ricardo


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: 2009 Survey Results
  • Next by Date: Re: removeObjectFromBothSidesOfRelationshipWithKey() question
  • Previous by thread: Re: 2009 Survey Results
  • Next by thread: Re: removeObjectFromBothSidesOfRelationshipWithKey() question
  • Index(es):
    • Date
    • Thread