addObjectToBothSides... and setValue
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