• 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
addObjectToBothSides... and setValue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

addObjectToBothSides... and setValue


  • Subject: addObjectToBothSides... and setValue
  • From: Drew Thoeni <email@hidden>
  • Date: Mon, 14 Feb 2005 22:56:25 -0500

I'm setting the relationship between a student and his classes. This is a many-to-many join (students to classes) so I'm interating through to set each relationship. I suppose that's correct.

Background: I'd also like to set a value on the newly inserted relationship row. For example, I have a lastAttemptedContactTime in this many-to-many join so I know when I last sent an email to this student for this class.

Question: How to easily set a value for each item in the many-to-many? I may be missing something here, but at the time the relationship is set, I don't think I have a classStudent (the many-to-many object) available to me. Or is there a way to have that object in hand so I could then just set the value?

Regards,

Drew

NSArray tempClassList = schoolItem.classes();
int count = tempClassList.count();
Class tempClassList = (Class) tempClassList.objectAtIndex(0);
int i = 0 ; i < count ; i++) {
((Class) tempClassList.objectAtIndex(i)).addObjectToBothSidesOfRelationshipWithKey(session.currentStudent, "students");
}
ec.saveChanges();
 _______________________________________________
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

  • Follow-Ups:
    • Re: addObjectToBothSides... and setValue
      • From: Owen McKerrow <email@hidden>
  • Prev by Date: Re: Setting Adaptor info at runtime
  • Next by Date: Re: addObjectToBothSides... and setValue
  • Previous by thread: Re: Setting Adaptor info at runtime
  • Next by thread: Re: addObjectToBothSides... and setValue
  • Index(es):
    • Date
    • Thread