![]() |
|||||||||||||||||
| |
|
|
|||||||||||||||
|
Accessing to-one relationships public void setStore(Store value) {
takeStoredValueForKey(value, "store");
}
public Store store() {
return storedValueForKey("store");
}
Used to take a column from a database and store it in an EOContext EOF automatically determines method names from names of variables - So you must follow naming conventions to-one - variable has the same name as the relationship
Accessing to-many relationships public void addToClients(Client object) {
//add an object to the array
includeObjectIntoPropertyWithKey(object, "students");
}
public void removeFromClients(Client object) {
//remove an object from the array
excludeObjectFromPropertyWithKey(object, "students");
}
public void setClients(NSArray array) {...} //sets whole array
public NSArray clients() {...} //gets whole array
The variable corresponding to the relatonship refers to an array of objects Variable has the same name as the relationship so does the method that returns the array add and remove methods are used to add objects to and remove from the array
Page updated September 7, 2004
|
||||||||||||||||
|
|
|||||||||||||||||