Re: Updating / Replacing Parent Objects
Re: Updating / Replacing Parent Objects
- Subject: Re: Updating / Replacing Parent Objects
- From: Dirk Bajohr <email@hidden>
- Date: Sun, 1 Aug 2004 23:30:10 +0200
If you have a relationship between the two entities you
can call removeObjectFromBothSidesOfRelationshipWithKey() and
addObjectToBothSidesOfRelationshipWithKey(). If the relation is
to-1 you only need to use the second method.
myPost is the Post to be changed, newForum is your new Forum:
myPost.addObjectToBothSidesOfRelationshipWithKey(newForum, "forum");
myPost.editingContext().saveChanges();
- or -
newForum.addObjectToBothSidesOfRelationshipWithKey(myPost, "posts");
newForum.editingContext().saveChanges();
Cheers,
Dirk
Am 01.08.2004 um 18:38 schrieb Lotsa Cabo:
What is the best way to replace an object in a parent-child
relationship? Is there an "update" or "replace" method on an object?
Example:
Object #1 is "Forum" and object #2 is "Post." Assuming that one would
want to have a page which allows a "post" to be moved to a new forum,
the "post.forum" relationship would have to be modified so that the
"Forum" object is different.
What is the best and/or easiest way of doing this? If someone has a
snippet, that would be great.
Thanx,
Ryan
_________________________
Tired of spam? Signup for a FREE SpamJammer.Com account and say
goodbye to junk email forever!
_______________________________________________
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.
--
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.