• 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: Updating / Replacing Parent Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating / Replacing Parent Objects


  • Subject: Re: Updating / Replacing Parent Objects
  • From: Dirk Bajohr <email@hidden>
  • Date: Tue, 3 Aug 2004 16:45:54 +0200

Hi Nathan,
Yes, that's a good way in the following case:

aPost has a to-1 relationship to (= is in) aForum - you want to delete aPost

What to do:
1 EOEditingContext ec = aPost.editingContext();
2 // aPost.removeObjectFromBothSidesOfRelationshipWithKey(aForum, "forum");
3 ec.deleteObject(aPost);
4 ec.saveChanges();
Ann.: the delete rule will automatically remove the relationship from aPost to aForum (Step 2) (and vice versa if it exists)


But the original task was:

aPost has a to-1 relationship to (= is in) aForum1 - you want to move aPost to aForum2

What to do:
1 aPost.removeObjectFromBothSidesOfRelationshipWithKey(aForum1, "forum");
2 aPost.addObjectToBothSidesOfRelationshipWithKey(aForum2, "forum");
3 aPost.editingContext().saveChanges();
Ann.: if the relationship really is to-1 you can omit Step 1


Cheers,
Dirk

Am 03.08.2004 um 16:16 schrieb Nathan Dumar:

I'm still learning, so tell me if I'm wrong ...

Instead of using removeObjectFromBothSidesOfRelationshipWithKey, I usually just set the eomodel's Delete Rule to Nullify the relationship when an object is deleted.

Nathan

On Aug 1, 2004, at 6:48 PM, Dirk Bajohr wrote:

In a to-1 relationship (I assume you are using that from post to forum) you don't need to call remove... because a post can only be applied to 1 forum. If a post can be in more than 1 forum you have to call (before saving the EC):
myPost.removeObjectFromBothSidesOfRelationshipWithKey(oldForum, "forum");


But it won't hurt if you call it anyway ;-), I'm just a little bit lazy. I don't know what other people do, anyone?

Cheers,
Dirk

Am 01.08.2004 um 23:45 schrieb Lotsa Cabo:

Thanks for the reply, Dirk. In your examples above are you assuming
that "removeObjectFromBothSidesofRelationshipWithKey()" has already
been called? I notice you mentioned the method but did not include it
in either example.


R/S
Ryan

-- Dirk Bajohr iSOLUTION - Individuelle Software fuer moderne Kommunikation

Hauptstr. 50
53757 Sankt Augustin

T +49 2241 921567-0
F +49 2241 921567-89
http://www.isolution.de
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.





=============   Signature File   =============


Put your email in an envelope -- use PGP encryption.

Get your privacy for FREE at
http://www.pgp.com/products/freeware.html

My public key:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGP 8.0.3 - not licensed for commercial use: www.pgp.com

mQGiBEDt3kcRBADfmxBAiNMHdGeL0WIQc78dzrNIjN3S9cRsxBjAP7W0vv+RrZNr
eNwF/F8rGTopxXhfanjrzNDl0HL0g+zDGTshhxjBd9qkOmrhznFn1ZKvSp9KGpeA
CmDwVKBiYvVFoyltJ7PS2sZmk+1QzYy349MjWi6nGludip3nk/XftwigzwCg/7uG
C6JzdWxwXgIaoR1pudY2su8EALRQqpkiGfXY/PbrWIcPnrlCQGxpS55O+xYqvjGj
6XPqNEXnM3W5lpbCeMsVQxISqls1qOWY7bLPP1T8lJ4P0IXPi3YnEGHufi/wHZyb
fgrdZxmGNW1qNSsG83uwgyWEoFxqC5s0iZuJz2NpfvuGf/yXhg8FO8Z72V+iYyzi
XNnWA/4/svEF5eph/3ECsspJM/rX0NmmFSov5COhdAdgLZs6svMdn5clzarhxLvR
eLkUaTVPqLTzAZc8Hb8s2AGJxWruuMwCkVVzinNdyUTXNbjVmhvoEGfez1CKnRtz
+JzaMcuEWWWgf1sU7FSo8FXJNEpNFsjS+pLB/JiVPaszedhtYrQDTWFjiQBdBBAR
AgAdBQJA7d5HBQkAl5yABwsJCAcDAgoCGQEFGwMAAAAACgkQEPcdq6mbhBbmZgCe
K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bDG6HOobFBPe7tW7agBrHMKDTqsMND
kgeJRLEjTitFw11L2E5MnIyS1PU2d6UpuF/XR08EJGLOQSxBrZpavHef48FCyh91
8Gfi3hFByYmfvZSY1Ln241ElxNO8P4bcsEDZeHdJ27HyI3EBwSXgAbiT209lEfcl
vLfngsryTh4uAybtlp1MLQKrXDCySSG7hc9wZc4obHPJyiFfDYJXMRdk0zdfa5w9
zVjlE8PU5QAV561m3jG/JfbmUI70VzFbnJwIwlCF7ETtPNdzZiVPvFUqQzn5yPrT
d3OGr8BranU5AxWvsMKICn3hWDm47Z8YJeP0xpbwY3lP05i1IZna0tH2XpHXv3dm
6oOPbBDlxacs1CDmCbrqPnJkL6SBlTWB/7uJAFIEGBECABIFAkDt4e0FCQCXnIAF
GwwAAAAACgkQEPcdq6mbhBZclQCg/D0tO2OaPUBbgfdMwUnvvcYgS+MAn1SbAiCF
9YSThBQFbyjAdjYaw53j
=Vxb6
-----END PGP PUBLIC KEY BLOCK-----

This key expires on Oct 31, 2004. Request a new key on or after this date.


--
Dirk Bajohr
iSOLUTION - Individuelle Software fuer moderne Kommunikation

Hauptstr. 50
53757 Sankt Augustin

T +49 2241 921567-0
F +49 2241 921567-89
http://www.isolution.de
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Updating / Replacing Parent Objects
      • From: Lotsa Cabo <email@hidden>
References: 
 >Updating / Replacing Parent Objects (From: Lotsa Cabo <email@hidden>)
 >Re: Updating / Replacing Parent Objects (From: Dirk Bajohr <email@hidden>)
 >Re: Updating / Replacing Parent Objects (From: Lotsa Cabo <email@hidden>)
 >Re: Updating / Replacing Parent Objects (From: Dirk Bajohr <email@hidden>)
 >Re: Updating / Replacing Parent Objects (From: Nathan Dumar <email@hidden>)

  • Prev by Date: Cloudscape
  • Next by Date: Re: Subversion and Webobjects
  • Previous by thread: Re: Updating / Replacing Parent Objects
  • Next by thread: Re: Updating / Replacing Parent Objects
  • Index(es):
    • Date
    • Thread