• 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: addObjectToBothSidesOfRelationshipWithKey
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: addObjectToBothSidesOfRelationshipWithKey


  • Subject: Re: addObjectToBothSidesOfRelationshipWithKey
  • From: David LeBer <email@hidden>
  • Date: Fri, 20 Aug 2004 11:17:08 -0400

On 20-Aug-04, at 10:57 AM, Jeremy Matthews wrote:

I can replicate the code, and I can understand its functionality, but I'm having difficulty explaining it in English

addObjectToBothSidesOfRelationshipWithKey

Can anyone put this into simple English so I can explain it to another person?
I must be having a mental block after all those fetch specs...

It does exactly what it says.

It adds an Object to both sides of the relationship specified by the key.

So if you have aCompany with a relationship to aClient called 'clients'

aCompany.addObjectToBothSidesOfRelationshipWithKey(aClient, "clients");

Will add aClient to the array of clients for aCompany.

addObjectToBoth.... is a convenience method that you can rely on to do the "right thing" regardless of the relationship type. It has a companion removeObjectFromBothSidesOfRealtionshipWithKey(obj, key); They save you from having to do:

aCompany.addToClients(aClient);
aClient.setCompany(aCompany);

or if you have a many to many:

aCompany.addToClients(aClient);
aClient.addToCompanies(aCompany);

;david

--
David LeBer
Codebase Software Systems
site:   http://www.codebase.ca
blog: http://david.codebase.ca
_______________________________________________
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.


References: 
 >addObjectToBothSidesOfRelationshipWithKey (From: Jeremy Matthews <email@hidden>)

  • Prev by Date: addObjectToBothSidesOfRelationshipWithKey
  • Next by Date: Re: sorting output
  • Previous by thread: addObjectToBothSidesOfRelationshipWithKey
  • Next by thread: Direct to Web, Refresh change_stamp column
  • Index(es):
    • Date
    • Thread